forked from mozilla/activity-stream
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.system-addon.config.js
43 lines (41 loc) · 1.11 KB
/
webpack.system-addon.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
const path = require("path");
const absolute = relPath => path.join(__dirname, "system-addon", relPath);
const resourcePathRegEx = /^resource:\/\/activity-stream\//;
module.exports = {
entry: absolute("content-src/activity-stream.jsx"),
output: {
path: absolute("data/content"),
filename: "activity-stream.bundle.js"
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {presets: ["react"]}
},
{
test: /\.jsm$/,
exclude: /node_modules/,
loader: "babel-loader",
// Converts .jsm files into common-js modules
options: {plugins: [["jsm-to-commonjs", {basePath: resourcePathRegEx, replace: true}]]}
}
]
},
// This resolve config allows us to import with paths relative to the system-addon/ directory, e.g. "lib/ActivityStream.jsm"
resolve: {
extensions: [".js", ".jsx"],
modules: [
"node_modules",
"system-addon"
]
},
externals: {
"react": "React",
"react-dom": "ReactDOM",
"redux": "Redux",
"react-redux": "ReactRedux"
}
};