From 1496dca1bcd86e572be306b2de8adad1b1fcd5cc Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 15 Oct 2017 14:42:41 +0200 Subject: [PATCH] Add materialize in webpack configuration. --- webpack.config.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 0d2bff3..d88d95a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,16 +2,19 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require('webpack'); -const ConcatPlugin = require('webpack-concat-plugin'); module.exports = { context: path.resolve(__dirname, 'src'), entry: { - "main": [ + main: [ './main.ts' ], - "styles": [ + styles: [ './main.scss' + ], + vendor: [ + 'jquery', + 'materialize-css' ] }, devtool: 'source-map', @@ -115,21 +118,15 @@ module.exports = { }] }, plugins: [ - new ConcatPlugin({ - uglify: false, - 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.optimize.CommonsChunkPlugin({ + name: "vendor" }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", - "window.jQuery": "jquery" + "window.jQuery": "jquery", + "window.Materialize": "materialize-css", + "Materialize": "materialize-css" }), new webpack.ContextReplacementPlugin( /angular(\\|\/)core(\\|\/)@angular/,