-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
50 lines (49 loc) · 1.77 KB
/
webpack.config.js
File metadata and controls
50 lines (49 loc) · 1.77 KB
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
const path = require('path');
const webpack = require('webpack');
require('dotenv').config();
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/js/index.js', //location of your main js file
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/bundle.js' // where js files would be bundled to
},
module: {
rules: [
// the url-loader uses DataUrls.
// the file-loader emits files.
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' }
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html', // name of html file to be created
template: './src/index.html' // source from which html file would be created
}),
new webpack.DefinePlugin({
__MAPBOX_TOKEN__: JSON.stringify(process.env.MAPBOX_TOKEN),
__SERVER_ENDPOINT__: JSON.stringify(process.env.SERVER_ENDPOINT)
}),
new webpack.ProvidePlugin({ // inject ES5 modules as global vars
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
}),
new CopyPlugin({
patterns: [{
from: './src/css',
to: 'css'
},
{
from: './src/assets',
to: 'assets'
}
]
})
]
}