generated from paul-boegelsack/babylonjs-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
53 lines (50 loc) · 1.43 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
const path = require('path')
const fs = require('fs')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const appDirectory = fs.realpathSync(process.cwd())
const mode = process.env.NODE_ENV || 'development'
const prod = mode === 'production'
const entry = prod ? 'src/rts-selection/index.ts' : 'src/app.ts'
const htmlPlugin = !prod
? [
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(appDirectory, 'public/index.html'),
}),
]
: []
module.exports = {
target: 'web',
entry: path.resolve(appDirectory, entry), //path to the main .ts file
output: {
filename: 'rts-selection.js', //name for the javascript file that is created/compiled in memory
},
resolve: {
fallback: {
fs: false,
path: false,
},
extensions: ['.ts', '.js'],
},
devServer: {
host: 'localhost',
port: 8080, //port that we're using for local host (localhost:8080)
static: path.resolve(appDirectory, 'public'), //tells webpack to serve from the public folder
hot: false,
devMiddleware: {
publicPath: '/',
},
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
devtool: 'inline-source-map',
plugins: htmlPlugin,
mode,
}