2016-08-03 71 views
0

我想在我的本地(我自己的包)中測試一個NPM包。我遵循這個指南:http://rajasekarm.com/publishing-react-component-npm/無法解析模塊index.js npm包

我在的package.json有這樣的:

"scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1", 
    "build": "./node_modules/.bin/babel statbox.js -o index.js", 
    "prepublish": "npm run build" 
}, 

我致力於在我的git這個定製包,並做了一個

npm install 'url/url/my_sample.git' --save

但是,當我做一個:

import myModule from 'my_sample'

它說index.js是未解決的。我該如何解決這個問題?

回答

0

如果沒有index.js文件,我想你沒有內置(因爲npm build將會把你的statbox.jsindex.js)。

因此運行npm build並重新測試您的軟件包。

相關問題