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
Options for directory index files and file extensions #24
Comments
Thanks for taking the time to develop and document this feature. However, there is a standardized way to load modules in ES:
These options add non-standardized (afaik) behaviour, so I'm not yet convinced if this is the way to go. How about writing a plugin that transforms the shortened imports to their respective filenames? I tend to only accept new functionality that's available in https://webpack.js.org/configuration/dev-server/#devserver => I will add this to the readme |
Yeah, I know what you mean, but this is just a use case for this feature, and even so, I believe a user should be able to load modules this way. The es modules spec does not say anything about the module resolution mechanism. This does, however respect the node module resolution mechanism, which makes it easier to share code both on the server and on the client, for universal apps. Also, maybe it's worth mentioning that other servers have similar config options: Apache has Would it be acceptable to have a similar |
OK, I would say the default value is To reduce complexity, how about just a flag: |
Currently there is no way to specify directory index files, and default file extensions. This is extremely useful when using the dev server in conjunction with es6 modules directly in the browser.
Let's say we have the following structure:
The
index.js
file acts as a public module api, and exports some symbols:We also have configured our environment is such a way to be able to import the above module like this:
If this runs inside the browser, it will fail, as the dev server does not know it needs to also look into the
my-module
folder for a directory index file, or to try some default file extensions when resolving the requested resources.I have added this pull request which adds these capabilities to the dev server. #21
The text was updated successfully, but these errors were encountered: