This repository was archived by the owner on Nov 17, 2023. It is now read-only.
forked from vielsoft/drupal-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
59 lines (57 loc) · 1.39 KB
/
webpack.config.js
File metadata and controls
59 lines (57 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const additionalAssets = new CopyWebpackPlugin([
{ from: './src/nodejs.config.js.example', to: 'nodejs.config.js.example' },
{ from: './src/server.package.json', to: 'package.json' },
]);
module.exports = {
entry: {
app: './src/app.ts',
},
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
},
externals: [
nodeExternals(),
// exclude any extensions from being packaged into this app
function (context, request, callback) {
if (/\bextensions\b/.test(context)) {
return callback(null, 'commonjs ' + request);
}
callback();
},
],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader?configFile=tsconfig.json',
exclude: /node_modules|package.json/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
library: '',
libraryTarget: 'commonjs',
},
target: 'node',
mode: 'development',
optimization: {
// setting this to false can help with debugging but should use true for
// building a production version of the server.
minimize: false,
},
node: {
__dirname: false,
},
plugins: [
additionalAssets,
],
};