【发布时间】:2018-09-27 20:30:21
【问题描述】:
我对 SharePoint 加载项和 ReactJS 非常陌生,但我正在努力让这两个人一起工作。我现在拥有的是我的 ReactJS 应用程序和一个空的 SharePoint 托管应用程序作为独立项目。
我关注了article,一切似乎都运行良好,直到我决定尝试更复杂的东西(使用 react-route、redux 等)。然后它停止工作(SharePoint 什么也没显示,devTool 中也没有错误)。
我想问题是在部署我的应用程序时,我的 SharePoint 网站上没有 react-router、redux 等依赖项。问题是如何将所有依赖项(我应该吗?)添加到 bundle.js 文件(由 webpack 生成),以便我可以将此 bundle.js 复制到 SharePoint 应用程序并使其正常工作?或者有没有其他方法可以做到这一点?
附:这是我的 webpack-config.js
module.exports = {
devtool: 'source-map',
entry: "./app.js",
mode: "development",
output: {
filename: "./app-bundle.js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'react']
}
}
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
}
}
如果您需要有关项目结构、配置等的其他信息,请告诉我。
谢谢!
【问题讨论】:
标签: reactjs sharepoint sharepoint-addin