Add materialize in webpack configuration.

This commit is contained in:
Alexis Lahouze 2017-10-15 14:42:41 +02:00
parent 4982931457
commit 1496dca1bc

View File

@ -2,16 +2,19 @@
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack'); const webpack = require('webpack');
const ConcatPlugin = require('webpack-concat-plugin');
module.exports = { module.exports = {
context: path.resolve(__dirname, 'src'), context: path.resolve(__dirname, 'src'),
entry: { entry: {
"main": [ main: [
'./main.ts' './main.ts'
], ],
"styles": [ styles: [
'./main.scss' './main.scss'
],
vendor: [
'jquery',
'materialize-css'
] ]
}, },
devtool: 'source-map', devtool: 'source-map',
@ -115,21 +118,15 @@ module.exports = {
}] }]
}, },
plugins: [ plugins: [
new ConcatPlugin({ new webpack.optimize.CommonsChunkPlugin({
uglify: false, name: "vendor"
sourceMap: true,
useHash: false,
name: "vendor",
fileName: "[name].bundle.js",
filesToConcat: [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/materialize-css/dist/js/materialize.min.js"
]
}), }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
$: "jquery", $: "jquery",
jQuery: "jquery", jQuery: "jquery",
"window.jQuery": "jquery" "window.jQuery": "jquery",
"window.Materialize": "materialize-css",
"Materialize": "materialize-css"
}), }),
new webpack.ContextReplacementPlugin( new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/, /angular(\\|\/)core(\\|\/)@angular/,