在构建我的打字稿 - 反应应用程序之后,在浏览器中运行后,我得到的模块未定义错误。
请注意,我的目标是电子渲染器。使用èlectron .
运行时似乎一切正常,但是当我在浏览器中提供它时,它会开始显示此错误。
var path = require("path")
var webpack = require("webpack")
module.exports = {
debug: true,
devtool: "inline-source-map",
entry: {
index: ["index.tsx", "babel-polyfill", "ts-helpers"]
},
output: {
path: path.resolve(__dirname, "build"),
filename: "[name].js",
libraryTarget: "commonjs2"
},
resolve: {
root: [
path.resolve(__dirname, "src")
],
extensions: ["", ".ts", ".tsx", ".js", ".jsx"]
},
module: {
loaders: [
{
test: /\.tsx?$/,
loaders: [
"babel-loader",
"ts-loader"
]
},
{
test: /\.jsx?$/,
loaders: [
"babel-loader"
]
},
{
test: /\.json$/,
loaders: [
"json-loader"
]
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
target: "electron-renderer"
}