forked from AtelierIHMTable/TUIOSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
92 lines (88 loc) · 2.15 KB
/
webpack.common.js
File metadata and controls
92 lines (88 loc) · 2.15 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
const path = require('path');
const fs = require('fs');
/* eslint-disable import/no-extraneous-dependencies */
const combineLoaders = require('webpack-combine-loaders/combineLoaders');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
/* eslint-enable import/no-extraneous-dependencies */
const includePaths = [
fs.realpathSync(`${__dirname}/src`),
fs.realpathSync(`${__dirname}/node_modules/tuiomanager/`),
];
const resolvePaths = [
fs.realpathSync(`${__dirname}/node_modules/`),
];
const htmlWebpackPluginInstance = new HtmlWebpackPlugin({
template: './index.ejs',
filename: './index.html',
showErrors: true,
});
const copyWebpackPluginInstance = new CopyWebpackPlugin(
[
{ from: './assets', to: './assets' },
],
{
copyUnmodified: false,
debug: 'debug',
}
);
module.exports = () => (
{
devServer: {
inline: true,
historyApiFallback: true,
port: 3000,
},
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'index.js',
},
resolve: {
extensions: ['', '.js'],
root: resolvePaths,
fallback: resolvePaths,
},
resolveLoader: {
root: resolvePaths,
fallback: resolvePaths,
},
eslint: {
configFile: './.eslintrc',
},
module: {
loaders: [
{
test: /\.js?$/,
loader: combineLoaders([
{
loader: 'babel-loader',
query: {
babelrc: false,
presets: [
'es2015',
].map(dep => require.resolve(`babel-preset-${dep}`)),
plugins: [
'transform-object-rest-spread',
].map(dep => require.resolve(`babel-plugin-${dep}`)),
},
},
{
loader: 'eslint-loader',
},
]),
include: includePaths
},
{
test: /\.json$/,
loader: 'json',
},
],
},
plugins: [
htmlWebpackPluginInstance,
copyWebpackPluginInstance
]
}
);