Last active
June 6, 2018 02:28
-
-
Save sumbad/7411bea8daf9f58a18d5892e0fc7e09c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module.exports = { | |
context: PATHS.root, | |
target: 'web', | |
entry, | |
resolve: { | |
extensions: ['.ts', '.js', '.json'], | |
modules: [PATHS.src, PATHS.node_modules], | |
}, | |
module: { | |
rules: [{ | |
test: /\.ts$/, | |
loaders: [{ | |
loader: 'awesome-typescript-loader', | |
options: { | |
transpileOnly: process.env.NODE_ENV !== 'production' | |
} | |
}, | |
'angular2-template-loader', | |
'angular2-router-loader' | |
], | |
exclude: [/\.(spec|e2e)\.ts$/], | |
}, | |
{ | |
test: /\.ts$/, | |
include: [/\.(spec|e2e)\.ts$/], | |
loaders: ['awesome-typescript-loader', 'angular2-template-loader'] | |
}, | |
{ | |
test: /\.json$/, | |
use: 'json-loader' | |
}, | |
{ | |
test: /\.html$/, | |
use: [{ | |
loader: 'html-loader', | |
}], | |
}, | |
{ | |
test: /\.(eot|woff|woff2|ttf|png|jpg|gif|svg|ico)(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'file-loader', | |
options: { | |
context: PATHS.assets, | |
name: '[path][name].[ext]' | |
}, | |
}, | |
{ | |
test: /\.css$/, | |
loader: extractSASS.extract({ | |
fallback: 'style-loader', | |
use: 'css-loader?sourceMap' | |
}), | |
exclude: [path.join(PATHS.projectPath), path.join(PATHS.src, 'common'), path.join(PATHS.src, 'common-bill')], | |
}, | |
{ | |
test: /\.css$/, | |
include: [path.join(PATHS.projectPath), path.join(PATHS.src, 'common'), path.join(PATHS.src, 'common-bill')], | |
use: [{ | |
loader: "raw-loader" // creates style nodes from JS strings | |
}], | |
}, | |
{ | |
test: /\.(scss|sass)$/, | |
loader: extractSASS.extract({ | |
use: [{ | |
loader: "css-loader", | |
}, | |
{ | |
loader: "sass-loader", | |
options: { | |
sourceMap: true, | |
} | |
} | |
], | |
// use style-loader in development | |
fallback: "style-loader" | |
}), | |
exclude: [path.join(PATHS.projectPath), path.join(PATHS.src, 'common'), path.join(PATHS.src, 'common-bill')], | |
}, | |
{ | |
test: /\.(scss|sass)$/, | |
use: [{ | |
loader: "raw-loader" // creates style nodes from JS strings | |
}, | |
{ | |
loader: "sass-loader", // compiles Sass to CSS | |
options: { | |
sourceMap: true | |
} | |
} | |
], | |
include: [path.join(PATHS.projectPath), path.join(PATHS.src, 'common'), path.join(PATHS.src, 'common-bill')], | |
} | |
] | |
}, | |
plugins: [ | |
extractSASS, | |
new webpack.IgnorePlugin(/vertx/), | |
new webpack.ContextReplacementPlugin( | |
// The (\\|\/) piece accounts for path separators in *nix and Windows | |
/\@angular(\\|\/)core(\\|\/)esm5/, | |
PATHS.projectPath, // location of your src | |
{} // a map of your routes | |
), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: ['vendor', 'polyfills'], | |
// minChunks: Infinity | |
}), | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment