forked from colmtuite/styleguide-export
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (87 loc) · 2.52 KB
/
Copy pathwebpack.config.js
File metadata and controls
96 lines (87 loc) · 2.52 KB
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
86
87
88
89
90
91
92
93
94
95
96
const path = require('path');
const webpack = require('webpack');
const Eyeglass = require('eyeglass');
const autoprefixer = require('autoprefixer');
const paths = {
root: __dirname,
src: path.resolve(__dirname, 'src'),
dist: path.resolve(__dirname, 'dist'),
};
const eyeglass = new Eyeglass({
outputStyle: 'compressed',
// eyeglass options
eyeglass: {
root: paths.root,
buildDir: path.resolve(paths.dist, 'site'),
assets: {
httpPrefix: path.join('styleguide', 'assets'),
sources: [{
directory: path.resolve(paths.src, 'assets'),
globOpts: {
pattern: 'images/**/*',
},
}],
},
},
});
module.exports = {
context: path.join(paths.src, 'site'),
devtool: 'source-map',
entry: [
'./index.html',
'./js/index.jsx',
],
module: {
// TODO: Remove this line when https://github.com/webpack/webpack/issues/1721 is fixed
noParse: [/autoit.js/],
preLoaders: [
{
test: /\.js$/,
loader: 'source-map-loader',
},
],
loaders: [
{
test: /\.(html|png|jpg|jpeg|gif|svg)$/,
loader: 'file?name=[path][name].[ext]',
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel-loader', 'eslint-loader'],
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'postcss', 'sass'],
},
],
},
resolve: {
root: path.resolve(paths.src, 'site'),
packageAlias: 'browser',
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx'],
},
output: {
filename: 'app.js',
path: path.resolve(paths.dist, 'site', 'styleguide'),
publicPath: '/styleguide/',
libraryTarget: 'umd',
library: 'marvelStyleguide',
},
sassLoader: eyeglass.options,
postcss: () => [autoprefixer],
plugins: [new webpack.HotModuleReplacementPlugin()],
devServer: {
stats: {
colors: true,
},
contentBase: path.resolve(paths.dist, 'site'),
historyApiFallback: {
rewrites: [
{ from: /\/styleguide\/app.js/, to: '/app.js' },
{ from: /\/styleguide\/images\/(.*)/, to: context => `/images/${context.match[1]}` },
],
},
hot: true,
},
};