Skip to content

Commit

Permalink
Update webpack file
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed May 31, 2017
1 parent 5e926b6 commit 94265e3
Showing 1 changed file with 12 additions and 57 deletions.
69 changes: 12 additions & 57 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
//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: {
filename: './dist/' + name + '.min.js',
library: name,
libraryTarget: 'umd',
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
})
],
plugins: plugins,
resolve: {
modulesDirectories: ['src', 'node_modules'],
alias: {
Expand Down Expand Up @@ -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
};
*/

0 comments on commit 94265e3

Please sign in to comment.