diff --git a/webpack.config.js b/webpack.config.js index 449399fcc..225608da7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,7 +1,18 @@ //webpack --display-reasons var webpack = require('webpack'); +var pkg = require('./package.json'); +var env = process.env.WEBPACK_ENV; var name = 'grapesjs'; +var plugins = []; + +if(env !== 'dev'){ + plugins = [ + new webpack.optimize.UglifyJsPlugin({minimize: true}), + new webpack.BannerPlugin(pkg.name + ' - ' + pkg.version) + ] +} +plugins.push(new webpack.ProvidePlugin({$: 'jquery'})); module.exports = { entry: './src/main', output: { @@ -9,11 +20,7 @@ module.exports = { library: name, libraryTarget: 'umd', }, - plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - }) - ], + plugins: plugins, resolve: { modulesDirectories: ['src', 'node_modules'], alias: { @@ -50,56 +57,4 @@ module.exports = { Utils: 'utils', } }, - /* - module: { - loaders: [ - { test: /underscore/, loader: 'exports?_' }, - { test: /backbone/, loader: 'exports?Backbone!imports?underscore,jquery' }, - { test: /rte/, loader: 'exports?rte!imports?jquery' }, - { test: /backbone-undo/, loader: 'exports?backboneUndo!imports?backbone' }, - { test: /keymaster/, loader: 'exports?keymaster' }, - ] - }*/ } - -/* -amd: { jQuery: true } -var webpack = require('webpack'); -var pkg = require('./package.json'); -var name = 'grapesjs-plugin-ckeditor'; -var env = process.env.WEBPACK_ENV; -var plugins = []; - -plugins: [ - new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]), // saves ~100k from build - new webpack.optimize.UglifyJsPlugin({minimize: true}), - new webpack.BannerPlugin(pkg.name + ' - ' + pkg.version), - new webpack.DefinePlugin({'process.env.NODE_ENV': '"production"'}) -] - -module.exports = { - entry: './src/main', - output: { - filename: './dist/' + name + '.min.js', - library: name, - libraryTarget: 'umd', - }, - module: { - preLoaders: [ - { test: /\.json$/, loader: 'json'}, - ], - loaders: [ - { - test: /\.jsx?$/, - loader: 'babel-loader', - exclude: /node_modules/, - include: /src/, - query: { - presets: ['es2015'] - } - }, - ], - }, - plugins: plugins -}; - */