shrub/pkg/btc-wallet/config/webpack.prod.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-03-27 04:43:51 +03:00
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const urbitrc = require('./urbitrc');
module.exports = {
2021-04-22 04:35:58 +03:00
node: { fs: 'empty' },
2021-03-27 04:43:51 +03:00
mode: 'production',
entry: {
app: './src/index.js'
},
module: {
rules: [
{
test: /\.jsx?$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [
'@babel/transform-runtime',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties'
]
}
},
exclude: /node_modules/
},
{
test: /\.css$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader'
]
}
]
},
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
2021-05-27 04:28:55 +03:00
devtool: 'source-map',
2021-03-27 04:43:51 +03:00
plugins: [
new CleanWebpackPlugin()
],
output: {
2021-05-27 04:28:55 +03:00
filename: (pathData) => {
return pathData.chunk.name === 'app' ? 'index.[contenthash].js' : '[name].js';
},
2021-03-27 04:43:51 +03:00
path: path.resolve(__dirname, `../../arvo/app/btc-wallet/js/bundle`),
publicPath: '/',
},
optimization: {
minimize: true,
usedExports: true
}
};