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

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-03-27 04:43:51 +03:00
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
2021-09-13 04:19:11 +03:00
const HtmlWebpackPlugin = require('html-webpack-plugin');
2021-05-27 20:37:28 +03:00
// const urbitrc = require('./urbitrc');
2021-03-27 04:43:51 +03:00
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.tsx',
2021-03-27 04:43:51 +03:00
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
2021-03-27 04:43:51 +03:00
use: {
loader: 'ts-loader',
2021-03-27 04:43:51 +03:00
},
exclude: /node_modules/,
2021-03-27 04:43:51 +03:00
},
{
test: /\.css$/i,
2021-03-27 04:43:51 +03:00
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
],
2021-03-27 04:43:51 +03:00
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
2021-03-27 04:43:51 +03:00
},
2021-05-27 04:28:55 +03:00
devtool: 'source-map',
2021-03-27 04:43:51 +03:00
plugins: [
2021-09-13 04:19:11 +03:00
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Bitcoin Wallet',
template: './public/index.html',
}),
2021-03-27 04:43:51 +03:00
],
output: {
2021-05-27 04:28:55 +03:00
filename: (pathData) => {
return pathData.chunk.name === 'app'
? 'index.[contenthash].js'
: '[name].js';
2021-05-27 04:28:55 +03:00
},
2021-09-14 16:04:24 +03:00
path: path.resolve(__dirname, '../dist'),
2021-09-13 04:19:11 +03:00
publicPath: '/apps/bitcoin/',
2021-03-27 04:43:51 +03:00
},
optimization: {
minimize: true,
usedExports: true,
},
2021-03-27 04:43:51 +03:00
};