-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
74 lines (72 loc) · 2.1 KB
/
webpack.common.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
62
63
64
65
66
67
68
69
70
71
72
73
74
const CopyWebpackPlugin = require('copy-webpack-plugin');
const fs = require('fs');
const GenerateJsonPlugin = require('generate-json-webpack-plugin');
manifest = JSON.parse(fs.readFileSync('app/manifest.json'));
module.exports = {
config: {
entry: {
background: './app/scripts/background.ts',
content: './app/scripts/content.ts',
options: './app/scripts/options.tsx',
'eijiro.worker': './app/scripts/preprocess/eijiro.worker.ts',
},
target: 'web',
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: './app/images',
to: 'images',
},
{
from: './app/_locales',
to: '_locales',
},
]
}),
new GenerateJsonPlugin('manifest.json', manifest),
],
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192
}
}
]
},
{
test: /\.(sa|sc|c)ss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.styl$/,
use: 'style-loader!css-loader!stylus-loader'
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [
'node_modules/',
'app/scripts/',
],
alias: {
'handlebars': 'handlebars/dist/handlebars.js',
}
},
externals: {
"react": "React",
"react-dom": "ReactDOM",
}
},
manifest,
};