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

Duplicated identifier with external modules #526

Closed
ArrayZoneYour opened this issue Nov 13, 2020 · 1 comment
Closed

Duplicated identifier with external modules #526

ArrayZoneYour opened this issue Nov 13, 2020 · 1 comment

Comments

@ArrayZoneYour
Copy link
Contributor

ArrayZoneYour commented Nov 13, 2020

Input:

index.ts

export { default as A } from './A'
export { default as B } from './B'

A.tsx

import React from 'external'
export default () => {
  return <></>
}

B.tsx

import React from 'external'
export default () => {
  return <></>
}

Build Script
build.js

const esbuild = require('esbuild')
esbuild.build({
  entryPoints: ['./index.ts'],
  bundle: true,
  external: ['external'],
  outfile: 'out.js',
})

out.js

// ...
  // A.tsx
  const external = __toModule(require("external"));
  var A_default = () => {
    return /* @__PURE__ */ external.default.createElement(external.default.Fragment, null);
  };

  // B.tsx
  const external2 = __toModule(require("external"));   // duplicated require !
  var B_default = () => {
    return /* @__PURE__ */ external2.default.createElement(external2.default.Fragment, null);
  };
// ...

Related: #405

@evanw
Copy link
Owner

evanw commented Nov 25, 2020

Thanks for reporting this. Closing as a duplicate of #475.

@evanw evanw closed this as completed Nov 25, 2020
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

No branches or pull requests

2 participants