-
Notifications
You must be signed in to change notification settings - Fork 233
/
webpack.dev.js
52 lines (44 loc) · 1.25 KB
/
webpack.dev.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
const resolve = require('path').resolve;
const CopyPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const I18nPlugin = require('i18n-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 htmlLoader = {
test: /\.html$/,
use: { loader: 'html-loader?interpolate' }
};
const scssLoader = {
test: /\.scss$/,
use: extractSass.extract({
use: [
{
loader: 'css-loader',
options: { sourceMap: true, url: false }
},
{
loader: 'sass-loader',
options: { sourceMap: true }
}
],
fallback: 'style-loader'
})
};
const devLanguage = require('./languages/en.json');
module.exports = {
entry: ['./src/leaflet-measure.js'],
output: {
filename: 'leaflet-measure.js',
path: BUILD_DIR
},
devServer: {
contentBase: BUILD_DIR
},
module: {
rules: [htmlLoader, scssLoader]
},
plugins: [copySite, copyAssets, extractSass, new I18nPlugin(devLanguage)],
devtool: 'eval-source-map'
};