-
Notifications
You must be signed in to change notification settings - Fork 234
/
webpack-example.config.babel.js
59 lines (57 loc) · 1.41 KB
/
webpack-example.config.babel.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
/* eslint-disable import/no-extraneous-dependencies */
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import SasslintPlugin from 'sasslint-webpack-plugin';
import path from 'path';
const webpackExampleConfig = {
context: __dirname,
devtool: 'source-map',
target: 'web',
entry: {
example: './example/js/index.jsx',
},
output: {
filename: '[name].js',
},
module: {
rules: [
{
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'example'),
],
loader: 'babel-loader',
test: /\.jsx?$/,
}, {
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'example'),
],
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader'],
}),
test: /\.scss$/,
}, {
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'example'),
],
loader: 'eslint-loader',
test: /\.jsx?$/,
enforce: 'pre',
},
],
},
plugins: [
new ExtractTextPlugin('[name].css'),
new SasslintPlugin({
glob: './src/scss/**/*.scss',
ignorePlugins: ['extract-text-webpack-plugin'],
}),
],
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx'],
},
};
export default webpackExampleConfig;