Skip to content

Conversation

@layershifter
Copy link
Member

In #291 I was confused with behavior of Webpack and differences in require() and import handling.

The answer is simple:

  • require() is marked by default as code that contains side effects
  • import is marked as side effect free based on package.json entries

That explains why it worked in tests and a test project (they didn't have sideEffects: false in their package.json), but failed in packages from NPM.

That PR changes code to use import and adds a hook to mark generated files as containing side effects.

@github-actions
Copy link

github-actions bot commented Mar 27, 2023

📊 Bundle size report

🤖 This report was generated against 37bd6399e99ed84bde568d6577a2c737aaeb0444

@layershifter layershifter marked this pull request as ready for review March 27, 2023 09:30
@layershifter layershifter requested a review from a team as a code owner March 27, 2023 09:30
@layershifter layershifter force-pushed the chore/use-esm-imprort branch from aec42eb to 23229a8 Compare March 28, 2023 12:32
@layershifter layershifter enabled auto-merge (squash) March 28, 2023 12:41
@layershifter layershifter disabled auto-merge March 28, 2023 12:41
@layershifter layershifter merged commit a0b6a6c into microsoft:main Mar 28, 2023
@layershifter layershifter deleted the chore/use-esm-imprort branch March 28, 2023 12:41
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