Created
September 10, 2020 09:12
-
-
Save jmahc/3cb31dadbd1afe019605a0cec53d4945 to your computer and use it in GitHub Desktop.
Angular2 + Webpack DLL's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var LiveReloadPlugin = require('webpack-livereload-plugin'); | |
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin; | |
// @see https://stackoverflow.com/a/42561686 | |
module.exports = { | |
entry: __dirname + '/assets/app/app.ts', | |
output: { | |
filename: 'myApp.bundle.js', | |
path: __dirname + '/build/' | |
}, | |
// Turn on sourcemaps | |
devtool: 'source-map', | |
resolve: { | |
extensions: ['.ts', '.js'] | |
}, | |
plugins: [ | |
new LiveReloadPlugin({ | |
appendScriptTag: true | |
}), | |
// Fixes angular 2 warning | |
new webpack.ContextReplacementPlugin( | |
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, | |
__dirname | |
), | |
new DllBundlesPlugin({ | |
bundles: { | |
vendor: [ | |
'@angular/platform-browser', | |
'@angular/platform-browser-dynamic', | |
'@angular/core', | |
'@angular/common', | |
'@angular/forms', | |
'@angular/http', | |
'@angular/router', | |
'rxjs', | |
] | |
}, | |
dllDir: __dirname + '/build/', | |
webpackConfig: {} | |
}) | |
], | |
module: { | |
rules: [{ | |
enforce: 'pre', | |
test: /\.js$/, | |
loader: "source-map-loader" | |
}, | |
{ | |
enforce: 'pre', | |
test: /\.tsx?$/, | |
use: "ts-loader" | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment