-
Notifications
You must be signed in to change notification settings - Fork 116
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
Support common alternative extensions for entries. #39
Conversation
100% merge this! |
if (file.match(/\.js$/)) { | ||
var name = file.replace(/\.js$/, ""); | ||
if (file.match(/\.(m?js|ts)$/)) { | ||
var name = file.replace(/\.(m?js|ts)$/, ""); | ||
webpackConfig.entry[name] = "./" + name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One fix needed: above line should be changed to webpackConfig.entry[name] = "./" + file;
since webpack won't pick non-js files by "name", need explicit extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
I would like to see TypeScript support too 👍 |
if (file.match(/\.js$/)) { | ||
var name = file.replace(/\.js$/, ""); | ||
if (file.match(/\.(m?js|ts)$/)) { | ||
var name = file.replace(/\.(m?js|ts)$/, ""); | ||
webpackConfig.entry[name] = "./" + name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
I could use this feature, is a merge coming soon? |
This adds support for constructing entries from
.js
,.mjs
, and.ts
files. For the time being it is still up to users to define loaders and resolution rules for these extensions. It will also be up to users to define typings for TypeScript entries though I may put some in a future PR.