Skip to content

Commit

Permalink
fix(cli): resolve modules using node algorithm instead of hardcode
Browse files Browse the repository at this point in the history
  • Loading branch information
shyshy committed Oct 3, 2019
1 parent 4e33f1c commit f65d366
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const rollup = require('broccoli-rollup');
const rollupNodeResolve = require('rollup-plugin-node-resolve');
const rollupCommonjs = require('rollup-plugin-commonjs');
const rollupBabel = require('rollup-plugin-babel');
const resolvePackagePath = require('resolve-package-path');

let environment;

Expand All @@ -21,7 +22,11 @@ function maybeDebug(tree, name) {
}

function getMonacoEditorModulePath() {
var monacoEditorModulePath = 'node_modules/monaco-editor';
const monacoEditorModulePath = resolvePackagePath('monaco-editor')
.split('/')
.slice(0, -1)
.join('/');

return environment !== 'production'
? monacoEditorModulePath + '/dev/vs'
: monacoEditorModulePath + '/min/vs';
Expand Down Expand Up @@ -120,8 +125,13 @@ module.exports = {
'3-es-rollup'
);

const regeneratorPath = require.resolve('regenerator-runtime')
.split('/')
.slice(0, -1)
.join('/');

const regeneratorTree = maybeDebug(
new Funnel('node_modules/regenerator-runtime', {
new Funnel(regeneratorPath, {
include: ['runtime.js'],
destDir: '.'
}),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ember-cli-typescript": "^2.0.0-rc.1",
"monaco-editor": "^0.16.0",
"penpal": "^3.0.7",
"resolve-package-path": "^1.2.7",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0"
Expand Down

0 comments on commit f65d366

Please sign in to comment.