fune/browser/components/newtab/webpack.system-addon.config.js
Victor Porof 1f830c96da Bug 1561435 - Format browser/components/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D36042

--HG--
extra : source : d3afcafdce650a6f36cebbc126ee93b17f13cf52
2019-07-05 09:53:32 +02:00

61 lines
1.7 KiB
JavaScript

const path = require("path");
const webpack = require("webpack");
const absolute = relPath => path.join(__dirname, relPath);
const resourcePathRegEx = /^resource:\/\/activity-stream\//;
module.exports = (env = {}) => ({
mode: "none",
entry: absolute("content-src/activity-stream.jsx"),
output: {
path: absolute("data/content"),
filename: "activity-stream.bundle.js",
},
// TODO: switch to eval-source-map for faster builds. Requires CSP changes
devtool: env.development ? "inline-source-map" : false,
plugins: [new webpack.optimize.ModuleConcatenationPlugin()],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules\/(?!(fluent|fluent-react)\/).*/,
loader: "babel-loader",
options: {
presets: ["@babel/preset-react"],
plugins: [["@babel/plugin-proposal-async-generator-functions"]],
},
},
{
test: /\.jsm$/,
exclude: /node_modules/,
loader: "babel-loader",
// Converts .jsm files into common-js modules
options: {
plugins: [
[
"jsm-to-esmodules",
{
basePath: resourcePathRegEx,
removeOtherImports: true,
replace: true,
},
],
],
},
},
],
},
// This resolve config allows us to import with paths relative to the root directory, e.g. "lib/ActivityStream.jsm"
resolve: {
extensions: [".js", ".jsx"],
modules: ["node_modules", "."],
},
externals: {
"prop-types": "PropTypes",
react: "React",
"react-dom": "ReactDOM",
redux: "Redux",
"react-redux": "ReactRedux",
},
});