shrub/pkg/interface/config/webpack.dev.js

68 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-04-24 02:08:47 +03:00
const path = require('path');
2020-04-30 01:48:25 +03:00
// const HtmlWebpackPlugin = require('html-webpack-plugin');
// const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const urbitrc = require('./urbitrc');
2020-04-24 02:08:47 +03:00
module.exports = {
2020-04-30 01:48:25 +03:00
mode: 'development',
2020-04-24 02:08:47 +03:00
entry: {
app: './src/index.js'
},
module: {
rules: [
{
test: /\.js?$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [
'@babel/plugin-proposal-object-rest-spread',
2020-04-30 01:48:25 +03:00
'@babel/plugin-proposal-optional-chaining'
2020-04-24 02:08:47 +03:00
]
}
},
2020-04-30 01:48:25 +03:00
exclude: /node_modules/
2020-04-24 02:08:47 +03:00
},
2020-04-30 01:48:25 +03:00
{
2020-04-30 02:02:59 +03:00
test: /\.css$/i,
2020-04-30 01:48:25 +03:00
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader'
]
}
]
2020-04-24 02:08:47 +03:00
},
resolve: {
2020-04-30 01:48:25 +03:00
extensions: ['.js']
2020-04-24 02:08:47 +03:00
},
devtool: 'inline-source-map',
// devServer: {
// contentBase: path.join(__dirname, './'),
// hot: true,
// port: 9000,
// historyApiFallback: true
// },
2020-04-24 02:08:47 +03:00
plugins: [
2020-04-28 23:49:39 +03:00
// new CleanWebpackPlugin(),
// new HtmlWebpackPlugin({
// title: 'Hot Module Replacement',
// template: './public/index.html',
// }),
2020-04-24 02:08:47 +03:00
],
output: {
filename: 'index.js',
chunkFilename: 'index.js',
path: path.resolve(urbitrc.URBIT_PIERS[0] + '/app/launch/', 'js'),
2020-04-24 02:08:47 +03:00
publicPath: '/'
},
2020-04-28 23:49:39 +03:00
optimization: {
2020-04-30 01:48:25 +03:00
minimize: false,
usedExports: true
2020-04-28 23:49:39 +03:00
}
2020-04-24 02:08:47 +03:00
};