-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
71 lines (70 loc) · 1.78 KB
/
webpack.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
const path = require('path');
const ExtractText = require('extract-text-webpack-plugin');
const GlobalStyle = new ExtractText('./../css/[name].global.styles.css');
const PageStyle = new ExtractText('./../css/[name].styles.css');
const PreRenderSpaPlugin = require('prerender-spa-plugin');
const HTMLPlugin = require('html-webpack-plugin');
const PreRenderOpts = {
captureAfterTime: 15000
}
const ArtTemplate = new HTMLPlugin({
template: 'views/art-template.html',
filename: path.resolve(__dirname, 'public/static/index.html')
})
const PreRender = new PreRenderSpaPlugin(path.resolve(__dirname, 'public/static'), ['/art', '/art/contact', '/art/gallery'], PreRenderOpts);
module.exports = {
entry: {
portfolio: './src/portfolio/index.js',
home: './src/home/index.js',
art: './src/art/index.js',
admin: './src/admin/index.js'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'public/js/')
},
module: {
rules: [
{
test: /\.scss$/,
loader: GlobalStyle.extract({
use: 'css-loader!sass-loader',
fallback: 'style-loader?importLoaders=1'
})
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: PageStyle.extract({
use: 'css-loader!sass-loader',
fallback: 'vue-style-loader'
})
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['es2015']
}
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader'
}
]
},
plugins: [
GlobalStyle,
PageStyle,
// ArtTemplate,
// PreRender
],
externals: {
async: 'commonjs async'
}
}