Coder Social home page Coder Social logo

Comments (3)

jflatow avatar jflatow commented on June 14, 2024

Ok, I believe I tracked this down to an issue with eval, which I know is evil, but still part of the language. I noticed that there can be various issues when bundling code with eval in it, but I've created a minimal example which reproduces the one I am reporting here (multiple mod definitions).

Consider three files: multi-mod.A.ts, multi-mod.B.ts, and multi-mod.importer.ts:

export class A {}
export class B {}
import * as m1 from './multi-mod.A.ts';
import * as m2 from './multi-mod.B.ts';
const { A } = m1;
const { B } = m2;
eval('');

If you bundle the importer script, you get multiple definitions of mod.

If you remove B from the picture you can see a different but related issue that Identifier 'A' has already been declared.

from deno_emit.

jflatow avatar jflatow commented on June 14, 2024

As a workaround for anyone else running into this issue: you can replace eval with window.eval if the code doesn't need access to local state.

from deno_emit.

jflatow avatar jflatow commented on June 14, 2024

There's a separate but related bug if you export the name mod in user-space code yourself, the emitted module gets overwritten.

from deno_emit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.