forked from Kupov/apress-assets-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
85 lines (83 loc) · 2.46 KB
/
webpack.dev.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
// jshint ignore: start
const path = require('path');
const webpack = require('webpack');
const nodeSass = require('node-sass');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = {
devtool: 'source-map',
entry: {
app: ['webpack-hot-middleware/client', 'babel-polyfill', path.resolve(__dirname, './src/index')],
'assets-table': [path.resolve(__dirname, './src/export')],
'assets-help': [path.resolve(__dirname, './src/exportHelp')]
},
output: {
library: 'Assets-table',
libraryTarget: 'umd',
filename: '[name].bundle.js',
path: path.resolve(__dirname, './dist'),
publicPath: '/static/',
},
module: {
rules: [{
enforce: 'pre',
test: /\.js|jsx$/,
exclude: /node_modules/,
use: ['eslint-loader'],
},
{
test: /\.js|jsx$/,
exclude: /node_modules/,
use: ['react-hot-loader', 'babel-loader'],
},
{
test: /\.scss|.sass$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader?sourceMap'
},
{
loader: 'sass-loader?sourceMap',
options: {
functions: {
'encode-base64($string)': ($string) => {
const buffer = new Buffer($string.getValue());
return nodeSass.types.String(buffer.toString('base64'));
}
},
}
}
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader?sourceMap'],
},
{
test: /\.woff$/,
use: 'url-loader?limit=65000000&mimetype=application/font-woff2&name=public/fonts/[name].[ext]'
}]
},
resolve: {
extensions: ['.js', '.jsx', '.css', '.scss'],
},
plugins: [
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify('development'),
'process.env.NODE_ENV': JSON.stringify('development')
}),
new ExtractTextPlugin({filename: '[name].css', allChunks: true}),
new webpack.BannerPlugin({banner: 'eslint-disable', entryOnly: false}),
new webpack.BannerPlugin({banner: 'jshint ignore: start', entryOnly: false}),
new webpack.BannerPlugin({banner: 'scss-lint:disable all', entryOnly: false}),
new CleanWebpackPlugin([
path.resolve(__dirname, './dist'),
path.resolve(__dirname, './dist'),
], {root: path.dirname(__dirname), verbose: true}),
new webpack.HotModuleReplacementPlugin(),
]
};
module.exports = config;