-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
44 lines (42 loc) · 1.09 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
"use strict";
const WebpackNotifierPlugin = require("webpack-notifier");
const webpack = require("webpack");
const BannerPlugin = webpack.BannerPlugin;
const path = require("path");
const absolute = (relPath) => path.join(__dirname, relPath);
class AddonPlugin extends BannerPlugin {
constructor(addonMainPath) {
super("const platform_require = require; const platform_exports = exports;\n", {
raw: true,
include: addonMainPath
});
}
}
let env = process.env.NODE_ENV || "development";
module.exports = {
entry: {
"/lib/main": "./src/main.js",
"/data/content-script": "./src/content-script.js",
"/data/main-sidebar": "./src/main-sidebar.js"
},
output: {
path: __dirname,
filename: "[name].js",
},
module: {
loaders: [
{test: /\.json$/, loader: "json"},
{
test: /.js?$/,
loader: 'babel-loader',
include: /src/,
query: {presets: ['react']}
}
]
},
// devtool: env === "production" ? null : "eval", // This is for Firefox
plugins: [
new WebpackNotifierPlugin(),
new AddonPlugin("/lib/main")
]
};