使用简单的工作React示例,然后将此行添加到顶部:
import Amplify from 'aws-amplify';
重新加载时产生以下错误:
未捕获的ReferenceError:未定义require
我正在使用webpack和一个简单的React渲染组件,这很简单。 aws-amplify的软件包使用npm
安装。
webpack.config.js如下:
var webpack = require("webpack");
var path = require("path");
var DEV = path.resolve(__dirname, "dev");
var OUTPUT = path.resolve(__dirname, "output");
var config = {
entry: DEV + "/index.jsx",
output: {
path: OUTPUT,
filename: "myCode.js"
},
module: {
rules: [{
include: DEV,
loader: "babel-loader",
}]
}
};
module.exports = config;