forked from Graphite-Docs/graphite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·89 lines (86 loc) · 2.56 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
77
78
79
80
81
82
83
84
85
86
87
88
89
const path = require('path');
const webpack = require('webpack');
// copy manifest.json to the path: 'public/build'
// this will allow for the authRequest to see the file at www.example.com/manifest.json
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ManifestAssetPlugin = new CopyWebpackPlugin([ { from: 'src/assets/manifest.json', to: 'manifest.json' } ]);
const IconAssetPlugin = new CopyWebpackPlugin([ { from: 'src/images/icon-192x192.png', to: 'icon-192x192.png' } ]);
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
inject: 'body'
});
module.exports = {
entry: './src/index.js',
target: 'web',
output: {
path: path.resolve('public/build'),
filename: 'index_bundle.js',
},
devServer: {
historyApiFallback: true,
watchOptions: { aggregateTimeout: 300, poll: 1000 },
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST, GET, OPTIONS, DELETE, PUT",
"Access-Control-Allow-Headers": "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding",
},
},
module: {
rules: [
{ test: /\.json$/, use: 'json-loader' },
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ },
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/,
loader: 'file-loader!url-loader'
},
{ test: /\.css$/, loader: 'style-loader!css-loader' }
],
loaders: [
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/,
loader: 'file-loader'
},
]
},
resolve: {
alias: {
handsontable: path.resolve(__dirname, 'node_modules/handsontable-pro')
}
},
node: {
fs: 'empty',
tls: 'empty',
dgram: 'empty',
ws: 'empty',
},
plugins: [
HtmlWebpackPluginConfig,
ManifestAssetPlugin,
IconAssetPlugin,
// new UglifyJsPlugin({
// uglifyOptions: {
// mangle: {
// reserved: [
// 'Buffer',
// 'BigInteger',
// 'Point',
// 'ECPubKey',
// 'ECKey',
// 'sha512_asm',
// 'asm',
// 'ECPair',
// 'HDNode'
// ]
// }
// }
// })
]
}