forked from GrapesJS/grapesjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
76 lines (74 loc) · 2.17 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//webpack --display-reasons
//Remove jquery https://github.com/webpack/webpack/issues/1275
//Migrateing https://webpack.js.org/guides/migrating/
var webpack = require('webpack');
var pkg = require('./package.json');
var env = process.env.WEBPACK_ENV;
var name = 'grapes';
var plugins = [];
if(env !== 'dev'){
plugins = [
new webpack.optimize.UglifyJsPlugin({
//sourceMap: true,
minimize: true,
compressor: {warnings: false},
}),
new webpack.BannerPlugin(pkg.name + ' - ' + pkg.version),
//v2 new webpack.BannerPlugin({banner: 'Banner v2'});
]
}
plugins.push(new webpack.ProvidePlugin({$: 'jquery'}));
module.exports = {
entry: './src/main',
output: {
filename: './dist/' + name + '.min.js',
library: 'grapesjs',
libraryTarget: 'umd',
},
plugins: plugins,
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
include: /src/,
exclude: /node_modules/,
query: {presets: ['es2015']}
}],
},
resolve: {
modulesDirectories: ['src', 'node_modules'],
alias: {
jquery: 'jquery/dist/jquery',
underscore: 'underscore/underscore',
backbone: 'backbone/backbone',
backboneUndo: 'backbone-undo/Backbone.Undo',
keymaster: 'keymaster/keymaster',
text: 'requirejs-text/text',
Spectrum: 'spectrum-colorpicker/spectrum',
codemirror: 'codemirror',
formatting: 'codemirror-formatting/formatting',
PluginManager: 'plugin_manager',
Abstract: 'domain_abstract',
Editor: 'editor',
AssetManager: 'asset_manager',
BlockManager: 'block_manager',
TraitManager: 'trait_manager',
StyleManager: 'style_manager',
DeviceManager: 'device_manager',
StorageManager: 'storage_manager',
PluginManager: 'plugin_manager',
Navigator: 'navigator',
DomComponents: 'dom_components',
RichTextEditor: 'rich_text_editor',
SelectorManager: 'selector_manager',
ModalDialog: 'modal_dialog',
CodeManager: 'code_manager',
CssComposer: 'css_composer',
Commands: 'commands',
Canvas: 'canvas',
Panels: 'panels',
Parser: 'parser',
Utils: 'utils',
}
},
}