Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not append the .js extension to module names twice #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prantlf
Copy link
Contributor

@prantlf prantlf commented Jan 2, 2022

Paths relative to the current directory include the file extension. But the recognition is not easy, because the name parameter passed to the plugin is not the original module name from the source code. For example:

import from 'src/sum'  ==> the plugin gets 'src/sum'
import from './sum'    ==> the plugin gets 'src/sum'
import from './sum.js' ==> the plugin gets 'src/sum.js'

RequireJS does not allow appending .js to module names from not relative paths. However, when writing a plugin, the ./ is not passed to it. As a workaround, I check if the name does not end with .js. Not the ultimate fix, but works probably well enough.

…current path

Paths relative to the current directory include the file extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant