我建立了一个新的奥雷利亚项目使用最新的奥雷利亚-cli。我选择使用webpack和TypeScript。在使用webpack的时候,在向项目中添加插件的时候,似乎没有太多的文档。我想加入奥雷利亚-奥斯。我尝试将它添加到我的package.json中的aurelia部分:
"aurelia": {
"build": {
"resources": [
"aurelia-auth"
]
}
}然后使用它:
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'))
.plugin(PLATFORM.moduleName('aurelia-auth'), (baseConfig)=>{
baseConfig.configure({});
});但似乎并不是所有的事情都是这样的:
未处理的拒绝错误:无法找到ID为aurelia/auth-filter的模块
在使用Aurelia和webpack捆绑和运行应用程序时,添加引用的正确方法是什么?
发布于 2017-08-30 16:26:23
Webpack:
在webpack.config.js中,plugins属性中有一个ModulesDependenciesPlugin条目。在其中添加aurelia-auth,例如:
new ModuleDependenciesPlugin({
'aurelia-testing': [ './compile-spy', './view-spy' ],
'aurelia-auth': [ './auth-filter' ]
}),For RequireJS:您应该将插件添加到aurelia.json的build.bundles.dependencies属性中。
尝试以下几点:
"dependencies": [
...,
{
"name": "aurelia-auth",
"path": "../node_modules/aurelia-auth/dist/amd",
"main": "aurelia-auth"
}
]https://stackoverflow.com/questions/45949046
复制相似问题