From 3d9e2dcf4c84adfe70b4fa0fa902c241174d17a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 Mar 2017 16:24:56 +0200 Subject: [PATCH] scoped library --- configuration/helpers.js | 7 +++++++ configuration/webpack.dll.js | 19 +++++++++++++++++++ src/app/app.js | 2 +- webpack.config.js | 4 ++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 configuration/helpers.js create mode 100644 configuration/webpack.dll.js diff --git a/configuration/helpers.js b/configuration/helpers.js new file mode 100644 index 000000000..253fa7d92 --- /dev/null +++ b/configuration/helpers.js @@ -0,0 +1,7 @@ +var path = require('path'); +var _root = path.resolve(__dirname, '..'); +function root(args) { + args = Array.prototype.slice.call(arguments, 0); + return path.join.apply(path, [_root].concat(args)); +} +exports.root = root; \ No newline at end of file diff --git a/configuration/webpack.dll.js b/configuration/webpack.dll.js new file mode 100644 index 000000000..38f6db1ad --- /dev/null +++ b/configuration/webpack.dll.js @@ -0,0 +1,19 @@ +var webpack = require('webpack'); +var helpers = require('./helpers'); + +module.exports = { + entry: { + angular: ['angular'] + }, + output: { + filename: '[name].bundle.js', + path: helpers.root('dll'), + library: '[name]' + }, + plugins: [ + new webpack.DllPlugin({ + path: helpers.root('dll', '[name]-manifest.json'), + name: '[name]' + }) + ] +}; diff --git a/src/app/app.js b/src/app/app.js index d5e26c84a..7f23cc793 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -1,4 +1,4 @@ -import angular from 'angular'; +import angular from 'xyz/node_modules/angular/index.js'; import '../style/app.css'; diff --git a/webpack.config.js b/webpack.config.js index 0178162d6..bc63efffc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -160,6 +160,10 @@ module.exports = function makeWebpackConfig() { * List: http://webpack.github.io/docs/list-of-plugins.html */ config.plugins = [ + new webpack.DllReferencePlugin({ + scope: "xyz", + manifest: require('./dll/angular-manifest.json') + }), new webpack.LoaderOptionsPlugin({ test: /\.scss$/i, options: {