forked from nextgis/leaflet-measure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
46 lines (38 loc) · 1.15 KB
/
webpack.prod.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
const resolve = require('path').resolve;
const CopyPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BUILD_DIR = resolve(__dirname, 'dist');
const copyAssets = new CopyPlugin([{ from: './assets', to: 'assets', ignore: ['*.svg'] }]);
const copySite = new CopyPlugin([{ from: './example', to: './' }]);
const extractSass = new ExtractTextPlugin({ filename: 'leaflet-measure.css' });
const jsLoader = {
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader?optional=runtime',
options: { presets: ['@babel/preset-env'] }
}
};
const htmlLoader = {
test: /\.html$/,
use: { loader: 'html-loader?interpolate' }
};
const scssLoader = {
test: /\.scss$/,
use: extractSass.extract({
use: [{ loader: 'css-loader', options: { url: false } }, { loader: 'sass-loader' }],
fallback: 'style-loader'
})
};
module.exports = {
entry: ['./src/leaflet-measure.js'],
output: {
filename: `leaflet-measure.js`,
path: BUILD_DIR,
publicPath: '/dist/'
},
module: {
rules: [jsLoader, htmlLoader, scssLoader]
},
plugins: [copySite, copyAssets, extractSass]
};