From c5c5e6d81123aa5363065d60794475d4e90dda64 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 24 Mar 2016 22:51:50 +0000 Subject: [PATCH] Tell webpack not to parse the highlight.js languages Hopefully, this fixes https://github.com/vector-im/vector-web/issues/1046 without any side-effects. It relies on the fact that the languages files are pretty simple - in particular, they don't require any other modules. So we can tell webpack just to suck them in as they are, rather than parsing them and causing an explosm. --- webpack.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index c19438a0..32b7e3e1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,14 @@ module.exports = { { test: /\.js$/, loader: "babel", include: path.resolve('./src') }, // css-raw-loader loads CSS but doesn't try to treat url()s as require()s { test: /\.css$/, loader: ExtractTextPlugin.extract("css-raw-loader") }, - ] + ], + noParse: [ + // don't parse the languages within highlight.js. They cause stack + // overflows (https://github.com/webpack/webpack/issues/1721), and + // there is no need for webpack to parse them - they can just be + // included as-is. + /highlight\.js\/lib\/languages/, + ], }, output: { devtoolModuleFilenameTemplate: function(info) {