-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack-docs.config.js
82 lines (70 loc) · 2.34 KB
/
webpack-docs.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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
function makeDocsConfig() {
var plugins = [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("development"),
BROWSER: JSON.stringify(true)
}
}),
new ExtractTextPlugin({ filename: './example/dist/css/styles.css' })
];
var entry = [
'./example/src'
];
var publicPath = '/example/dist';
var babelPresets = [
"es2015",
"stage-0",
"react"];
devtool = 'inline-source-map';
var config = {
entry: entry,
node: {
fs: "empty"
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
path.resolve('./example/src'),
path.resolve(__dirname, "node_modules")
]
},
output: {
path: path.join(__dirname, 'example/dist'),
filename: 'app.js',
publicPath: publicPath
},
module: {
loaders: [
{
loader: "babel-loader",
// Skip any files outside of your project's `src` directory
include: [
path.resolve(__dirname, "example/src"),
path.resolve(__dirname, "src") //todo: only use this when importing source directly - remove once using distributable for examples
],
// Only run `.js` and `.jsx` files through Babel
test: /\.jsx?$/,
// Options to configure babel with
query: {
presets: babelPresets,
}
},
{
test: /\.scss$/,
exclude: /node_modules/,
include: path.join(__dirname, 'src/css'), // TODO: change back to example/src/css once using distributable
loader: ExtractTextPlugin.extract( { fallbackLoader: "style-loader", loader: "css-loader!sass" })
},
]
},
plugins: plugins,
devtool: devtool
};
return config;
}
module.exports = makeDocsConfig();