我正在开发一个名为density wars的 webgl RTS 游戏,但我遇到了很多错误,如下所示:
ERROR in [default] /Users/nikos/PhpstormProjects/Density-Wars/babylonjs.d.ts:1:15
Duplicate identifier 'BABYLON'.
在我的打字稿入口点,我这样做:
/// <reference path="./gameUnits/Core.ts" />
/// <reference path="./utils/UnitCommand.ts" />
/// <reference path="./utils/Formations.ts" />
/// <reference path="./User.ts" />
declare function require(module: string):any
require('../style.css');
var BABYLON = require('babylonjs');
webpack.config:
module.exports = {
context: __dirname + "/lib",
entry: {
main: [
"./game.ts"
]
},
output: {
path: __dirname + "/dist",
filename: "density-wars.js"
},
devtool: "source-map",
module: {
loaders: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader'
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
},
resolve: {
// you can now require('file') instead of require('file.js')
extensions: ['', '.js', '.json']
}
}