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

Support common alternative extensions for entries. #39

Closed
wants to merge 1 commit into from

Conversation

knpwrs
Copy link

@knpwrs knpwrs commented May 19, 2018

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.

@Offirmo
Copy link

Offirmo commented Aug 24, 2018

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;
Copy link

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@nunoarruda
Copy link

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@lastmjs
Copy link

lastmjs commented Oct 15, 2018

I could use this feature, is a merge coming soon?

stefan-- added a commit to stefan--/netlify-lambda that referenced this pull request Nov 1, 2018
@swyxio swyxio closed this in #76 Nov 12, 2018
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.

5 participants