-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.config.js
More file actions
106 lines (103 loc) · 3.54 KB
/
webpack.common.config.js
File metadata and controls
106 lines (103 loc) · 3.54 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
97
98
99
100
101
102
103
104
105
106
'use strict';
const path = require('path');
const AureliaWebpackPlugin = require('aurelia-webpack-plugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const pkg = require('./package.json');
const outputFileTemplateSuffix = '-' + pkg.version;
module.exports = function(definitions) {
return {
target: 'web',
devServer: {
host: '0.0.0.0',
port: 4000,
headers: {
'Access-Control-Allow-Origin': '*'
}
},
entry: {
main: [
'./src/main'
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: `main${outputFileTemplateSuffix}.js`,
chunkFilename: `[id]${outputFileTemplateSuffix}.js`
},
plugins: [
new DefinePlugin(definitions),
new AureliaWebpackPlugin({
includeSubModules: [
{moduleId: 'aurelia-validation'},
{moduleId: 'aurelia-dialog'}
]
}),
new ProvidePlugin({
Promise: 'bluebird/js/browser/bluebird.min.js',
'window.Promise': 'bluebird/js/browser/bluebird.min.js',
jQuery: 'jquery',
$: 'jquery',
'window.jQuery': 'jquery'
}),
new HtmlWebpackPlugin({
title: 'Edifice',
template: 'index.html',
filename: 'index.html',
favicon: './assets/img/favicon/favicon.ico'
}),
new CopyWebpackPlugin([
{ from: 'assets/img/favicon', to: 'assets/img/favicon' }
])
],
module: {
loaders: [{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules\/(?!edifice-structure-viewer)/,
query: {
presets: ['es2016', 'stage-2'],
plugins: ['transform-es2015-modules-commonjs', 'transform-decorators-legacy']
}
}, {
test: /\.css?$/,
loader: 'style!css'
}, {
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}, {
test: /\.html$/,
loader: 'html'
}, {
test: /\.(png|gif|jpg)$/,
loader: 'url?limit=8192'
}, {
test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url?limit=10000&mimetype=application/font-woff2'
}, {
test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url?limit=10000&mimetype=application/font-woff'
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file'
}, {
test: /node_modules[\\\/]auth0-lock[\\\/].*\.js$/,
loaders: [
'transform-loader/cacheable?brfs',
'transform-loader/cacheable?packageify'
]
}, {
test: /node_modules[\\\/]auth0-lock[\\\/].*\.ejs$/,
loader: 'transform-loader/cacheable?ejsify'
}, {
test: /\.json$/,
loader: 'json-loader'
}]
},
node: {
fs: "empty"
}
};
};