1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-10 17:04:36 +00:00

fix(webpack): removed process plugin from nodeConfig

This commit is contained in:
Yury Shkoda
2021-06-09 13:53:27 +03:00
parent c571bb8490
commit 155f2bb0e8

View File

@@ -2,19 +2,30 @@ const path = require('path')
const webpack = require('webpack')
const terserPlugin = require('terser-webpack-plugin')
const defaultPlugins = [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.SourceMapDevToolPlugin({
filename: null,
exclude: [/node_modules/],
test: /\.ts($|\?)/i
})
]
const optimization = {
minimize: true,
minimizer: [
new terserPlugin({
parallel: true,
terserOptions: {}
})
]
}
const browserConfig = {
entry: './src/index.ts',
devtool: 'inline-source-map',
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new terserPlugin({
parallel: true,
terserOptions: {}
})
]
},
optimization: optimization,
module: {
rules: [
{
@@ -35,20 +46,26 @@ const browserConfig = {
library: 'SASjs'
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.SourceMapDevToolPlugin({
filename: null,
exclude: [/node_modules/],
test: /\.ts($|\?)/i
}),
...defaultPlugins,
new webpack.ProvidePlugin({
process: 'process/browser'
})
]
}
const browserConfigWithoutProcessPlugin = {
entry: browserConfig.entry,
devtool: browserConfig.devtool,
mode: browserConfig.mode,
optimization: optimization,
module: browserConfig.module,
resolve: browserConfig.resolve,
output: browserConfig.output,
plugins: defaultPlugins
}
const nodeConfig = {
...browserConfig,
...browserConfigWithoutProcessPlugin,
target: 'node',
entry: './node/index.ts',
output: {