Git Product home page Git Product logo

Comments (6)

mzgoddard avatar mzgoddard commented on June 16, 2024

Hey @wmertens. I'm guessing you are doing something out of order. Are you using something imported before its imported? We had another bug like this related to exporting things before they were imported.

Do you have anything like

doSomething();
// ...
import {doSomething} from './some-file';

Just want to confirm so my regression test to go along with the fix keeps this from popping up again later.

from hard-source-webpack-plugin.

wmertens avatar wmertens commented on June 16, 2024

from hard-source-webpack-plugin.

wmertens avatar wmertens commented on June 16, 2024

I added a console.log(this) and this error happens for this this:

HardHarmonyImportSpecifierDependency {
  module: null,
  importDependency: undefined,
  importedVar: null,
  id: 'default',
  name: 'Promise',
  range: null,
  loc: 
   { start: { line: 5, column: 102 },
     end: { line: 5, column: 109 } } }

I changed it to log for this.name === 'Promise' and it turns out that the first run, it has Bluebird for Promise, and the second time, it shows the above output. So maybe something is using Promise before I polyfill it with Bluebird?

from hard-source-webpack-plugin.

wmertens avatar wmertens commented on June 16, 2024

All I needed to do was rename my bluebird import from Promise to something else and it stopped happening. Weird, because I never assigned to the Promise global, it seems that global name clashes are not appreciated?

from hard-source-webpack-plugin.

mzgoddard avatar mzgoddard commented on June 16, 2024

Oh wow. I think the Promise detail is exactly the issue. The good news is my 0.3.5 change in #80 works for this too. I'm guessing its a detail of the acorn parser webpack uses hoisting global names or some other similar mechanism effectively causing the specifier to appear before the import in the dependencies of that module.

I'm not worried about System.import being the cause. Its basically a fancy require.ensure dependency that doesn't have to deal with the more complex situations harmony imports and exports deal with.

Thanks for helping me figure this out @wmertens!

from hard-source-webpack-plugin.

wmertens avatar wmertens commented on June 16, 2024

🎉 can confirm it is fixed now!

Imports are hairy - I'm battling an issue where a Babel preset appears as an empty object unless I force-import it with node -r lib/myBabelPreset :-/

from hard-source-webpack-plugin.

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.