-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (59 loc) · 1.61 KB
/
webpack.config.js
File metadata and controls
69 lines (59 loc) · 1.61 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
60
61
62
63
64
65
66
67
68
69
'use strict'
const resolve = require('path').resolve
const webpack = require('webpack')
// const NpmInstallPlugin = require('npm-install-webpack-plugin')
const NotifierPlugin = require('webpack-notifier')
module.exports = {
target: 'node',
// target: 'electron',
// https://webpack.github.io/docs/configuration.html#node
// https://github.com/webpack/webpack/issues/1599
node: {
__dirname: false,
__filename: false,
},
// context: __dirname,
entry: {
'index.js': './src/index.js',
'runner.js': './src/runner.js',
'preload.js': './src/preload.js',
'test.js': './test/index.js',
},
output: {
pathinfo: true,
path: 'dist',
filename: '[name]',
},
module: {
preLoaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'eslint' },
],
loaders: [
{ test: /\.json$/, exclude: /node_modules/, loader: 'json' },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
],
},
resolve: {
extensions: ['', '.js'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
},
externals: [
(ctx, req, cb) => {
// if (resolve(ctx, req).indexOf(srcDir) !== 0) return cb()
if (/^\.\.?\//.test(req)) return cb()
cb(null, `commonjs ${req}`)
},
],
plugins: [
// new NpmInstallPlugin({ save: true }),
new NotifierPlugin({ alwaysNotify: true }),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
Promise: 'bluebird',
}),
new webpack.DefinePlugin({
// rootDir: `"${resolve(__dirname, '..')}"`,
// $dirname: '__dirname',
}),
],
}