justlog/web/webpack.config.babel.js

58 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-01-25 14:22:27 +01:00
const path = require("path");
2020-01-26 18:30:45 +01:00
const webpack = require("webpack");
2020-01-31 23:05:56 +01:00
const PnpWebpackPlugin = require(`pnp-webpack-plugin`);
2020-01-25 14:22:27 +01:00
2020-01-26 18:30:45 +01:00
module.exports = (env, options) => ({
2020-01-31 23:05:56 +01:00
2020-01-25 14:22:27 +01:00
entry: './src/index.jsx',
output: {
path: path.resolve(__dirname, 'public'),
filename: 'bundle.js',
publicPath: "/",
},
module: {
rules: [
{
test: /\.jsx$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.s?css$/,
use: ["style-loader", "css-loader", "sass-loader"]
},
]
},
resolve: {
extensions: ['.js', '.jsx'],
2020-01-31 23:05:56 +01:00
plugins: [
PnpWebpackPlugin,
],
2020-01-26 18:30:45 +01:00
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'apiBaseUrl': options.mode === 'development' ? '"http://localhost:8025"' : '""',
}
}),
2020-01-31 23:05:56 +01:00
],
resolveLoader: {
plugins: [
PnpWebpackPlugin.moduleLoader(module),
],
},
stats: {
// Config for minimal console.log mess.
assets: false,
colors: true,
version: false,
hash: false,
timings: true,
chunks: false,
chunkModules: false,
entrypoints: false,
modules: false,
},
2020-01-26 18:30:45 +01:00
});