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