Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: webpack.config.js

Issue 29549786: Issue 5535 - Replace our module system with webpack (Closed)
Patch Set: Improved resolve paths comment Created Sept. 24, 2017, 12:35 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « templates/modules.js.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webpack.config.js
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..12d023ceaaf8d9eb57ac36ca799dd4e9829a8fbb
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,96 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-present eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+const path = require("path");
+
+let {EXTENSION_PATH, ENTRY_POINTS, OUTPUT_PATH, BUNDLE_NAME,
+ RESOLVE_PATHS, INFO_PATH} = require("process").env;
+
+module.exports = {
+ context: EXTENSION_PATH,
+ devtool: "source-map",
+ entry: ENTRY_POINTS.split(" "),
+ externals: {
+ // Workaround for the fact that adblockplusui attempts to require
+ // "ext_background" (meaning adblockplusui/ext/background.js) if ext is
+ // falsey at bundle time. Once we've gotten rid of ext, or at least
+ // removed those requires from adblockplusui we can remove this.
+ ext_background: "ext"
Sebastian Noack 2017/09/24 15:03:38 adblockplusui attempts to require ext_background o
kzar 2017/09/24 16:02:46 FWIW This workaround simply avoids webpack replaci
Sebastian Noack 2017/09/24 20:42:15 You already removed other code from adblockplusui
kzar 2017/09/25 15:18:27 Done. (awaiting https://codereview.adblockplus.org
+ },
+ output: {
+ path: OUTPUT_PATH,
+ filename: BUNDLE_NAME
+ },
+ resolve: {
+ modules: RESOLVE_PATHS.split(" "),
+ alias: {
+ info$: INFO_PATH,
+ // Prevent builtin Node.js modules from being used instead of our own when
+ // the names clash. Once relative paths are used this won't be necessary.
+ url$: "url.js",
+ events$: "events.js",
+ punycode$: "punycode.js"
+ },
+ plugins: [
+ function()
+ {
+ // Our old module system in packagerChrome.py used to prefix
+ // module names with the name of their parent directory and an
+ // underscore - but only when that directory wasn't called
+ // "lib". This plugin is for backwards compatability, but can
+ // be removed once use of that deprecated syntax has been
+ // replaced.
+ this.plugin("described-resolve", (request, callback) =>
+ {
+ let target = request.request;
+
+ let prefix_index = target.indexOf("_");
+ if (prefix_index == -1)
+ return callback();
+
+ let prefix = target.substring(0, prefix_index);
+ if (prefix == "lib")
+ return callback();
+
+ let fixed_target = path.join(prefix,
+ target.substring(prefix_index + 1));
+ return this.doResolve(
+ "resolve", Object.assign({}, request, {request: fixed_target}),
+ "Changed prefixed path using legacy buildtools syntax from " +
+ target + " to " + fixed_target,
+ callback
+ );
+ });
+ }
+ ]
+ },
+ stats: {
+ assets: false,
+ children: false,
+ chunks: false,
+ errorDetails: true,
+ errors: true,
+ hash: false,
+ modules: false,
+ publicPath: false,
+ reasons: false,
+ source: false,
+ timings: false,
+ version: false,
+ warnings: true
+ }
+};
« no previous file with comments | « templates/modules.js.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld