aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/webpack.config.js')
-rw-r--r--vnext/server/webpack.config.js59
1 files changed, 14 insertions, 45 deletions
diff --git a/vnext/server/webpack.config.js b/vnext/server/webpack.config.js
index 9ffb3360..78c90050 100644
--- a/vnext/server/webpack.config.js
+++ b/vnext/server/webpack.config.js
@@ -1,21 +1,17 @@
-const ESLintPlugin = require('eslint-webpack-plugin')
-const TerserPlugin = require('terser-webpack-plugin')
+const nodeExternals = require('webpack-node-externals')
+const path = require('path')
-module.exports = () => {
- const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'
- const dev = node_env !== 'production'
- const config = {
- mode: node_env,
- devtool: dev ? 'cheap-module-source-map' : false,
+module.exports = {
+ devtool: false,
entry: {
'server': [
- __dirname + '/index.js'
+ path.resolve(__dirname, 'index.js')
]
},
target: 'node',
output: {
- path: __dirname + '/../../public',
- filename: '[name].js'
+ path: path.resolve(__dirname, '../../public'),
+ filename: '[name].js',
},
module: {
rules: [{
@@ -26,7 +22,8 @@ module.exports = () => {
loader: 'babel-loader'
}, {
test: /\.(png|jpe?g|gif|svg)$/i,
- type: 'asset/resource'
+ type: 'asset/resource',
+ dependency: { not: ['url'] },
}]
},
plugins: [
@@ -34,37 +31,9 @@ module.exports = () => {
resolve: {
symlinks: false,
extensions: ['.js']
- }
- }
- if (dev) {
- config.plugins.push(
- new ESLintPlugin({
- files: __dirname + '/src',
- lintDirtyModulesOnly: true,
- failOnWarning: false,
- failOnError: true,
- fix: false
- }))
- config.devServer = {
- hot: true,
- historyApiFallback: true,
- client: {
- overlay: {
- runtimeErrors: true
- }
- }
- }
- }
- config.optimization = {
- minimize: !dev,
- minimizer: [
- new TerserPlugin({
- minify: TerserPlugin.swcMinify,
- // `terserOptions` options will be passed to `swc` (`@swc/core`)
- // Link to options - https://swc.rs/docs/config-js-minify
- terserOptions: {},
- }),
- ]
+ },
+ externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
+ externals: [nodeExternals({
+ allowlist: [/\.(?!(?:jsx?|json)$).{1,5}$/i]
+ })],
}
- return config
-}