-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
99 lines (93 loc) · 3.75 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
const CopyWebpackPlugin = require('copy-webpack-plugin')
let webPackModule = {
mode: "development",
watch: true,
stats: false,
// entry: [ "./src/generators/generators.ts"],
// entry: [ "./src/sprite-animation/sprite-animation.ts"],
entry: "./src/from-zero/index.ts",
// entry: "./src/add-element/add-element.ts"],
output: {
filename: 'visualts.engine.js',
path: __dirname + "/build",
},
// devtool: "none",
resolve: {
extensions: [".js", ".ts", ".tsx", ".json"]
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader", options: { allowTsInNodeModules: true } },
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
name(resourcePath, resourceQuery) {
// `resourcePath` - `/absolute/path/to/file.js`
// `resourceQuery` - `?foo=bar`
// if (process.env.NODE_ENV === 'development') {
return './imgs/' + '[name].[ext]';
// }
// return '[contenthash].[ext]';
},
},
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(ico)$/,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '/styles'
}
}
},
{
test: /\.(mp4|ogg)$/,
// include: __dirname + "/src/examples/platformer-single-player/audios",
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: "/audios"
}
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: './template.html', to: 'index.html'},
{ from: './style/styles.css', to: 'style/styles.css'},
{ from: './style/broadcaster.css', to: 'styles/broadcaster.css' },
{ from: './style/getHTMLMediaElement.css', to: 'styles/getHTMLMediaElement.css' },
{ from: './externals/hack-timer.js', to: 'externals/hack-timer.js'},
{ from: './externals/drag.ts', to: 'externals/drag.ts' },
{ from: './externals/hack-timer-worker.js', to: 'externals/hack-timer-worker.js' },
{ from: './externals/cacheInit.ts', to: 'externals/cacheInit.ts' },
{ from: './externals/worker.js', to: 'worker.js' },
{ from: './externals/offline.html', to: 'offline.html' },
{ from: './externals/adapter.js', to: 'externals/adapter.js' },
{ from: "./src/ui/player-board.html", to: "templates/player-board.html"},
{ from: "./src/ui/select-player.html", to: "templates/select-player.html"},
{ from: "./src/ui/player-board.html", to: "templates/single-player-board.html"},
{ from: "./src/ui/message-box.html", to: "templates/message-box.html"},
{ from: 'src/html-components/register.html', to: 'templates/register.html' },
{ from: 'src/html-components/login.html', to: 'templates/login.html' },
{ from: 'src/html-components/user-profile.html', to: 'templates/user-profile.html' },
{ from: './src/html-components/store.html', to: 'templates/store.html' },
{ from: './src/html-components/games-list.html', to: 'templates/games-list.html' },
{ from: './src/html-components/video-conference.html', to: 'templates/video-conference.html' },
{ from: './src/html-components/broadcaster.html', to: 'templates/broadcaster.html' },
{ from: "./src/html-components/coordinator.html", to: "templates/coordinator.html" },
// { from: './externals/facebook/fb.js', to: 'externals/fb.js' },
// { from: './src/manifest.web', to: 'manifest.web' },
]})
],
};
module.exports = webPackModule;