-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.docs.js
104 lines (102 loc) · 2.72 KB
/
webpack.config.docs.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: './docs/scripts/main.js',
output: {
filename: './bundle.js',
path: path.resolve(__dirname, './docs-generated')
},
devtool: '#inline-source-map',
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
// presets: ['es2015'],
sourceMaps: ['inline']
}
}, {
test: /\.s?css$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader?sourceMap" // translates CSS into CommonJS
}, {
loader: "sass-loader", // compiles Sass to CSS
// options: {
// includePaths: [
// path.resolve(__dirname, "node_modules/roboto-fontface/fonts")
// ]
// }
}]
},
{
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
use: [{
loader: "file-loader",
options: {
name: '[path][name].[ext]'
}
}]
},
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
// minimize: true
}
}],
},
// {
// test: /\.png$|http/,
// use: ["url-loader?mimetype=image/png"]
// },
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
}, {
// Exposes jQuery for use outside Webpack build
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
}, {
loader: 'expose-loader',
options: '$'
}]
}]
},
plugins: [
new webpack.ProvidePlugin({
'window.jQuery': 'jquery',
$: 'jquery'
}),
new CopyWebpackPlugin([{
from: './docs/index.html',
to: './'
}, {
from: './docs/icons/',
to: './icons/'
},
{
from: './docs/screenshots',
to: './screenshots'
},
{
from: './docs/css',
to: './css'
},
{
from: './docs/webfonts',
to: './webfonts'
}
])
],
devServer: {
contentBase: path.join(__dirname, 'docs-generated')
}
};