mirror of https://github.com/oceanprotocol/ipfs
69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
const path = require('path')
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
|
|
|
const defaultInclude = [path.resolve(__dirname, 'src')]
|
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
|
|
module.exports = {
|
|
mode: isDevelopment ? 'development' : 'production',
|
|
entry: path.resolve(__dirname, 'src', 'index.js'),
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'bundle.js'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
include: defaultInclude,
|
|
use: [
|
|
{
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
plugins: ['@babel/plugin-proposal-class-properties']
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
include: defaultInclude
|
|
},
|
|
{
|
|
test: /\.(jpe?g|png|gif)$/,
|
|
use: ['file-loader?name=img/[name]__[hash:base64:5].[ext]'],
|
|
include: defaultInclude
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
use: [
|
|
{
|
|
loader: '@svgr/webpack',
|
|
options: {
|
|
icon: true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
extensions: ['*', '.js', '.jsx']
|
|
},
|
|
node: {
|
|
fs: 'empty',
|
|
net: 'empty',
|
|
tls: 'empty'
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({
|
|
filename: isDevelopment ? '[name].css' : '[name].[hash].css',
|
|
chunkFilename: isDevelopment ? '[id].css' : '[id].[hash].css'
|
|
}),
|
|
new CopyPlugin([{ from: './src/index.html', to: './', flatten: true }])
|
|
]
|
|
}
|