【发布时间】:2016-08-27 06:23:27
【问题描述】:
我在基于 webpack 骨架的demo Aurelia/enhance 应用程序中使用aurelia-gravatar 插件。
要使其正常工作,我必须手动将 "main": "dist/commonjs/index.js", 添加到 node_modules/aurelia-gravatar-component/package.json。
有没有办法从应用程序package.json 执行此覆盖?这对我不起作用:
"aurelia": {
"build": {
"resources": [
"aurelia-gravatar-component/gravatar"
]
},
"moduleRootOverride": {
"aurelia-gravatar-component": "dist/commonjs"
}
},
浏览器中的错误是Error: Cannot find module './aurelia-gravatar-component'.。
如何快速测试演示应用:
# get the demo app
git clone https://github.com/k2s/aurelia-skeleton-esnext-webpack-enhance.git
cd aurelia-skeleton-esnext-webpack-enhance
npm install
# manually add '"main": "dist/commonjs/index.js",' to 'node_modules/aurelia-gravatar-component/package.json'
# start serving the application
npm start
# open the application in browser
xdg-open http://localhost:9000
【问题讨论】: