-
Notifications
You must be signed in to change notification settings - Fork 144
/
webpack.config.js
61 lines (59 loc) · 1.53 KB
/
webpack.config.js
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
60
61
/* eslint import/order: 0 */
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const webpack = require('webpack');
// eslint-disable-next-line import/no-extraneous-dependencies
const nodeExternals = require('webpack-node-externals');
module.exports = {
// Set the webpack4 mode 'none' for compatibility with the behavior of the
// webpack3 bundling step.
mode: 'none',
entry: {
'addons-linter': './src/main.js',
},
target: 'node',
output: {
filename: '[name].js',
libraryTarget: 'commonjs2',
libraryExport: 'default',
path: path.join(__dirname, 'dist'),
},
module: {
rules: [
{
use: 'babel-loader',
// babel options are in babel.config.json
exclude: /(node_modules|bower_components)/,
test: /\.js$/,
},
{
use: 'raw-loader',
exclude: /(node_modules|bower_components)/,
test: /\.txt$/,
},
],
},
externals: [
nodeExternals({
modulesFromFile: true,
}),
],
plugins: [
new webpack.BannerPlugin({
banner: 'require("source-map-support").install();',
raw: true,
entryOnly: false,
}),
],
resolve: {
extensions: ['.js', '.json'],
modules: ['src', 'node_modules', 'vendor'],
},
devtool: 'source-map',
node: {
// This is required because the default value does not seem to be `false`.
// If this isn't set to `false`, `__dirname` is likely invalid and it
// prevents JS rules to be loaded correctly.
__dirname: false,
},
};