Skip to content

V2: Change default value of plugin option import_extension to none#832

Merged
srikrsna-buf merged 4 commits intov2from
sk/import_extension
May 9, 2024
Merged

V2: Change default value of plugin option import_extension to none#832
srikrsna-buf merged 4 commits intov2from
sk/import_extension

Conversation

@srikrsna-buf
Copy link
Member

Change default value of import_extension to none from .js.

In v1, we generate code using .js extension which is the spec compliant way (and has been for sometime) of importing js files. Node, TS, and browsers support this but bundlers still haven't caught up with it. Users filed several issues related to this.

With this change, the default will work in most places and where users do need them it can be configured using the import_extension=.js plugin option.

Important

This change affects all plugins written using protoplugin when they upgrade to v2.

Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

Looks good to me, but can you update packages/protoc-gen-es/README.md ?

let keepEmptyFiles = false;
const rewriteImports: RewriteImports = [];
let importExtension = ".js";
let importExtension = "";
Copy link
Member

Choose a reason for hiding this comment

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

💥 🤓

@timostamm timostamm changed the title Change default value of import_extension to none V2: Change default value of import_extension to none May 9, 2024
@srikrsna-buf srikrsna-buf requested a review from timostamm May 9, 2024 10:13
@srikrsna-buf srikrsna-buf force-pushed the sk/import_extension branch from 3956a3c to 0d0afc0 Compare May 9, 2024 11:16
@srikrsna-buf srikrsna-buf merged commit 9213d8c into v2 May 9, 2024
@srikrsna-buf srikrsna-buf deleted the sk/import_extension branch May 9, 2024 13:02
@timostamm timostamm changed the title V2: Change default value of import_extension to none V2: Change default value of plugin option import_extension to none May 13, 2024
@timostamm timostamm mentioned this pull request May 13, 2024
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.

2 participants