Fix webpack.plaground to inherit from webpack.common

This commit is contained in:
Paulo Gustavo Veiga 2021-12-21 20:53:30 -08:00
parent b29b75931e
commit 3ac1b939aa
4 changed files with 7 additions and 40 deletions

View File

@ -13,6 +13,8 @@ module.exports = {
optimization: { optimization: {
usedExports: true, usedExports: true,
}, },
mode: 'production',
devtool: 'source-map',
module: { module: {
rules: [ rules: [
{ {

View File

@ -10,7 +10,6 @@ const devConfig = {
open: true, open: true,
}, },
plugins: [new HotModuleReplacementPlugin()], plugins: [new HotModuleReplacementPlugin()],
devtool: 'eval-source-map',
}; };
module.exports = merge(common, devConfig); module.exports = merge(common, devConfig);

View File

@ -2,42 +2,23 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');
const common = require('./webpack.common');
const { merge } = require('webpack-merge');
module.exports = { const playgroundConfig = {
entry: { entry: {
layout: path.resolve(__dirname, './test/playground/layout/context-loader'), layout: path.resolve(__dirname, './test/playground/layout/context-loader'),
viewmode: path.resolve(__dirname, './test/playground/map-render/js/viewmode'), viewmode: path.resolve(__dirname, './test/playground/map-render/js/viewmode'),
embedded: path.resolve(__dirname, './test/playground/map-render/js/embedded'), embedded: path.resolve(__dirname, './test/playground/map-render/js/embedded'),
editor: path.resolve(__dirname, './test/playground/map-render/js/editor'), editor: path.resolve(__dirname, './test/playground/map-render/js/editor'),
}, },
output: {
path: path.resolve(__dirname, 'dist', 'test'),
filename: '[name].test.js',
publicPath: '',
},
devServer: { devServer: {
historyApiFallback: true, historyApiFallback: true,
port: 8081, port: 8081,
open: false, open: false,
}, },
mode: 'production',
optimization: {
splitChunks: {
chunks: 'all',
minSize: 2000000,
},
},
devtool: 'source-map',
module: { module: {
rules: [ rules: [
{
use: 'babel-loader',
test: /.js$/,
exclude: [
/node_modules/,
/lib\/raphael/ig,
],
},
{ {
test: /\.less$/i, test: /\.less$/i,
use: [ use: [
@ -47,19 +28,8 @@ module.exports = {
'less-loader', 'less-loader',
], ],
}, },
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
], ],
}, },
resolve: {
alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'),
},
extensions: ['.js', '.json'],
},
plugins: [ plugins: [
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new CopyPlugin({ new CopyPlugin({
@ -97,3 +67,5 @@ module.exports = {
}), }),
], ],
}; };
module.exports = merge(common, playgroundConfig);

View File

@ -3,14 +3,8 @@ const CompressionPlugin = require('compression-webpack-plugin');
const common = require('./webpack.common'); const common = require('./webpack.common');
const prodConfig = { const prodConfig = {
mode: 'production',
devtool: 'source-map',
optimization: { optimization: {
minimize: true, minimize: true,
splitChunks: {
chunks: 'all',
minSize: 2000000,
},
}, },
plugins: [ plugins: [
new CompressionPlugin({ new CompressionPlugin({