-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
38 lines (36 loc) · 1.17 KB
/
webpack.config.js
File metadata and controls
38 lines (36 loc) · 1.17 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
const path = require('path');
const ScreepsWebpackPlugin = require("./src/screeps-webpack-plugin/index");
module.exports = env => {
let screepsConfig;
let dryRun = false;
const destination = env.DEST;
if (!destination) {
console.log("No destination specified - code will be compiled but not uploaded");
dryRun = true;
} else if ((screepsConfig = require("./screeps.json")[destination]) == null) {
throw new Error("Invalid upload destination");
}
return {
mode: "development",
target: "node",
entry: './src/main.ts',
// devtool: "inline-source-map",
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: "commonjs"
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
// { test: /\.js$/, use: ["source-map-loader"], enforce: "pre" },
{ test: /\.tsx?$/, loader: 'ts-loader' },
]
},
plugins: [
new ScreepsWebpackPlugin({ config: screepsConfig, dryRun: dryRun })
]
};
};