/
webpack.dev.js
51 lines (44 loc) · 1.33 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
'use strict'
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const baseDir = process.cwd()
let g4uPackageInfo = require(path.join(baseDir, 'package.json'))
if (g4uPackageInfo.name !== 'guide4you') {
g4uPackageInfo = require(path.join(baseDir, 'node_modules/guide4you/package.json'))
}
const g4uVersion = g4uPackageInfo.version
// let baseDir = process.cwd()
module.exports = {
mode: 'development',
plugins: [
new webpack.DefinePlugin({ SWITCH_DEBUG: '\'DEBUG\'', GUIDE4YOU_VERSION: '\'v' + g4uVersion + '\'' }),
new ExtractTextPlugin({
filename: 'css/[name]-[hash].css'
}),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map'
}),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
new CopyWebpackPlugin([
{ from: 'node_modules/jquery/dist/jquery.js', to: 'js/jquery.js' }
]),
new HtmlWebpackIncludeAssetsPlugin({
assets: [
'js/jquery.js'
],
append: false
})
],
devtool: 'eval-source-map',
output: {
filename: 'js/[name]-[hash].js'
},
devServer: {
inline: true,
publicPath: '/'
}
}