UNPKG

1.99 kBJavaScriptView Raw
1/**
2 * Adapted from angular2-webpack-starter
3 */
4
5const helpers = require('./config/helpers'),
6 webpack = require('webpack'),
7 CleanWebpackPlugin = require('clean-webpack-plugin');
8
9/**
10 * Webpack Plugins
11 */
12const ProvidePlugin = require('webpack/lib/ProvidePlugin');
13const DefinePlugin = require('webpack/lib/DefinePlugin');
14const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
15
16module.exports = {
17 devtool: 'inline-source-map',
18
19 resolve: {
20 extensions: ['.ts', '.js']
21 },
22
23 entry: helpers.root('index.ts'),
24
25 output: {
26 path: helpers.root('bundles'),
27 publicPath: '/',
28 filename: 'core.umd.js',
29 library: 'ngx-translate-core',
30 libraryTarget: 'umd'
31 },
32
33 // require those dependencies but don't bundle them
34 externals: [/^\@angular\//, /^rxjs\//],
35
36 module: {
37 rules: [{
38 enforce: 'pre',
39 test: /\.ts$/,
40 loader: 'tslint-loader',
41 exclude: [helpers.root('node_modules')]
42 }, {
43 test: /\.ts$/,
44 loader: 'awesome-typescript-loader',
45 options: {
46 declaration: false
47 },
48 exclude: [/\.spec\.ts$/]
49 }]
50 },
51
52 plugins: [
53 // fix the warning in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
54 new webpack.ContextReplacementPlugin(
55 /angular(\\|\/)core(\\|\/)@angular/,
56 helpers.root('./src')
57 ),
58
59 new webpack.LoaderOptionsPlugin({
60 options: {
61 tslintLoader: {
62 emitErrors: false,
63 failOnHint: false
64 }
65 }
66 }),
67
68 // Reference: https://github.com/johnagan/clean-webpack-plugin
69 // Removes the bundle folder before the build
70 new CleanWebpackPlugin(['bundles'], {
71 root: helpers.root(),
72 verbose: false,
73 dry: false
74 })
75 ]
76};