diff --git a/js-packages/webpack-config/README.md b/js-packages/webpack-config/README.md index 5736da8a0..d0a5f917e 100755 --- a/js-packages/webpack-config/README.md +++ b/js-packages/webpack-config/README.md @@ -6,9 +6,5 @@ This package generates a [Webpack](https://webpack.js.org) config object that wi // webpack.config.js var config = require('flarum-webpack-config'); -module.exports = config(options); +module.exports = config(); ``` - -## Options - -* `compatPrefix` Old-style module prefix (eg. `flarum/sticky`) to alias. Setting this will also enable importing old-style core modules (eg. `import foo from 'flarum/foo'`). diff --git a/js-packages/webpack-config/index.js b/js-packages/webpack-config/index.js index b9a811747..612c1cce4 100644 --- a/js-packages/webpack-config/index.js +++ b/js-packages/webpack-config/index.js @@ -34,28 +34,19 @@ module.exports = function(options = {}) { path.resolve(process.cwd(), 'node_modules'), 'node_modules' ] - } - }; - - if (options.compatPrefix) { - // Strip the old-style module prefix from non-relative-path imports by - // aliasing it to nothing. - config.resolve = config.resolve || {}; - config.resolve.alias = { - [options.compatPrefix]: '.' - }; + }, // Support importing old-style core modules. - config.externals = [ + externals: [ function(context, request, callback) { let matches; - if ((matches = /^flarum\/(.+)$/.exec(request)) && request.substr(0, options.compatPrefix.length) !== options.compatPrefix) { + if ((matches = /^flarum\/(.+)$/.exec(request))) { return callback(null, 'root flarum.compat[\'' + matches[1] + '\']'); } callback(); } - ]; - } + ] + }; return config; }; diff --git a/js-packages/webpack-config/package.json b/js-packages/webpack-config/package.json index 22e399231..4bbfee8ab 100644 --- a/js-packages/webpack-config/package.json +++ b/js-packages/webpack-config/package.json @@ -1,6 +1,6 @@ { "name": "flarum-webpack-config", - "version": "0.1.0-beta.5", + "version": "0.1.0-beta.6", "description": "", "main": "index.js", "author": "Toby Zerner",