-
Notifications
You must be signed in to change notification settings - Fork 15
/
webpack.config.js
101 lines (98 loc) · 2.99 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
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
const path = require('path');
const Webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WorkboxPlugin = require('workbox-webpack-plugin');
const { version } = require('./package.json');
const rootDir = modulePath => path.resolve(__dirname, modulePath);
module.exports = {
entry: './scripts/main.js',
mode: 'production',
output: {
path: path.join(__dirname, 'dist'),
filename: 'main.js',
},
devtool: 'source-map',
resolveLoader: {
alias: {
text: 'raw-loader'
}
},
resolve: {
modules: [
'node_modules',
],
symlinks: false,
alias: {
'@jeremyckahn/stylie': rootDir('node_modules/@jeremyckahn/stylie/scripts/stylie'),
'jquery-cubelet': rootDir('node_modules/jquery-cubelet/dist/jquery.cubelet'),
'jquery-dragon': rootDir('node_modules/jquery-dragon/src/jquery.dragon'),
'lateralus.component.tabs': rootDir('node_modules/@jeremyckahn/lateralus-components/tabs/main'),
'rekapi-timeline': rootDir('node_modules/rekapi-timeline/scripts/rekapi-timeline'),
aenima: rootDir('node_modules/aenima'),
backbone: rootDir('node_modules/backbone/backbone'),
bezierizer: rootDir('node_modules/bezierizer/dist/bezierizer'),
jquery: rootDir('node_modules/jquery/dist/jquery'),
keydrown: rootDir('node_modules/keydrown/dist/keydrown'),
lateralus: rootDir('node_modules/lateralus/dist/lateralus'),
lodash: rootDir('node_modules/lodash/index.js'),
mustache: rootDir('node_modules/mustache/mustache'),
rekapi: rootDir('node_modules/rekapi/src/main'),
shifty: rootDir('node_modules/shifty/src/index'),
underscore: 'lodash'
}
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
include: [
rootDir('scripts'),
rootDir('node_modules/shifty'),
rootDir('node_modules/rekapi'),
rootDir('node_modules/aenima'),
rootDir('node_modules/rekapi-timeline'),
rootDir('node_modules/@jeremyckahn'),
rootDir('node_modules/webpack-dev-server')
]
}, {
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: [{
loader: 'file-loader'
}]
}, {
test: /\.(sass|scss|css)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'sass-loader',
options: {
sourceMap: true,
includePaths: [
rootDir('node_modules/compass-mixins/lib')
]
}
}]
}
]
},
plugins: [
new CleanWebpackPlugin([ 'dist' ]),
new CopyWebpackPlugin([
{ from: 'index.html' },
{ from: 'manifest.json' },
{ from: 'img', to: 'img' }
]),
new Webpack.BannerPlugin(version),
new WorkboxPlugin.GenerateSW({
exclude: [/\.(?:DS_Store|xcf)$/],
})
],
devServer: {
host: '0.0.0.0',
port: 9006
}
};