forked from froala/react-froala-wysiwyg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (66 loc) · 1.52 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
var path = require('path');
/**
* If -p flag is set, minify the files
* @type {boolean}
*/
var src = (process.argv.indexOf('-p') === -1);
var filenamePostfix = src ? '.src' : '';
var froalaExternals = {
'froala-editor': {
root: 'froala-editor',
commonjs2: 'froala-editor/js',
commonjs: 'froala-editor/js',
amd: 'froala-editor/js'
}
};
var reactExternals = {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
}
};
var externals = [reactExternals];
module.exports = {
entry: {
// Array syntax to workaround https://github.com/webpack/webpack/issues/300
'index': ['./lib/FroalaEditor.jsx'],
'FroalaEditorA': ['./lib/FroalaEditorA.jsx'],
'FroalaEditorButton': ['./lib/FroalaEditorButton.jsx'],
'FroalaEditorImg': ['./lib/FroalaEditorImg.jsx'],
'FroalaEditorInput': ['./lib/FroalaEditorInput.jsx'],
'FroalaEditorView': ['./lib/FroalaEditorView.jsx']
},
module: {
rules: [
{
test: /\.jsx$/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['react','es2015', 'stage-2']
}
}
]
}
]
},
externals: externals,
resolve: {
modules: ['./node_modules']
},
output: {
filename: 'dist/[name]' + filenamePostfix + '.js',
libraryTarget: 'umd',
library: '[name]'
}
};