2017-04-12 49 views
0

這僅供開發使用。如何在燼寶應用中使用Vanillajs +外部node_modules腳本

我想在現有的餘燼應用使用https://www.npmjs.com/package/test-recorderhttps://github.com/travis-ci/travis-web

所有我想要的腳本加載並運行此代碼,新TestRecorder()

什麼是最小的疼痛免費的解決方案?

+0

燼,browserify – Lux

+0

@Lux它的痛苦,當輸入蛋白的世界g webpack構建的東西:https://github.com/ember-cli/ember-cli/issues/6954 – Nikos

回答

0

直到燼NPM支持開箱即用的,我的方法是怎樣的複製到供應商,然後在灰燼-CLI-build.js導入:

的package.json:

​​

燼-CLI-build.js:

app.import('vendor/test-recorder.js');

+0

我會用一個簡單的漏斗+合併樹來做到這一點。所以你可以在你的構建過程中做到這一點。使用in-repo-addon應該很簡單。 – Lux

+0

你能表演嗎?我試圖避免做一個插件。 – Nikos

+0

你可以試試[ember-cli-node-assets](https://github.com/dfreeman/ember-cli-node-assets)插件。它適用於我和在簡單情況下[你甚至不需要使用''app.import''](https://github.com/dfreeman/ember-cli-node-assets#import-shorthand)。 –