Skip to content

refactor: use createRequire to load/resolve modules#5092

Merged
pksunkara merged 2 commits into
vuejs:devfrom
haoqunjiang:resolve-module-with-create-require
Jan 23, 2020
Merged

refactor: use createRequire to load/resolve modules#5092
pksunkara merged 2 commits into
vuejs:devfrom
haoqunjiang:resolve-module-with-create-require

Conversation

@haoqunjiang

Copy link
Copy Markdown
Member

See import-js/eslint-plugin-import#1591 and import-js/eslint-plugin-import#1602

As far as I understand, createRequire is the only semantically correct way to resolve modules from a different context.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

@haoqunjiang

Copy link
Copy Markdown
Member Author

@arcanis Can this change eliminate the need to move Generator logic into project local dependencies as said in #4531?

Comment thread packages/@vue/cli-shared-utils/lib/module.js Outdated
@arcanis

arcanis commented Jan 19, 2020

Copy link
Copy Markdown
Contributor

@sodatea I improved Yarn in yarnpkg/berry#630 to support the use case of Vue-CLI (and CRA), so the problem we described in #4531 should be fixed!

That said the changes in this PR sound for the best regardless because of the post I shared you on Twitter (yarnpkg/berry#693 (comment)) 👍

@haoqunjiang haoqunjiang changed the title refactor: use createRequire to resolve modules refactor: use createRequire to load/resolve modules Jan 20, 2020
@pksunkara pksunkara merged commit 15679de into vuejs:dev Jan 23, 2020
@arcanis

arcanis commented Jan 23, 2020

Copy link
Copy Markdown
Contributor

By any chance, can master be released? I'll be releasing the very first stable build for Yarn 2 tomorrow morning 😊

@haoqunjiang

haoqunjiang commented Jan 24, 2020

Copy link
Copy Markdown
Member Author

That soon?
OK, I'll try to squeeze some time to test it and release a new version in hours. It's Chinese New Year's Eve today so I didn't expect a new release… But a patch is fine.

@arcanis

arcanis commented Jan 24, 2020

Copy link
Copy Markdown
Contributor

Oh I'm sorry, I should have told you about the release earlier - please disregard, it's not that urgent (people will be able to add your Vue plugin anyway).

Happy new year!

mactanxin pushed a commit to mactanxin/vue-cli that referenced this pull request Feb 11, 2020
* refactor: use createRequire to resolve modules

* fix: use file path as createRequire argument; fix loadModule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants