4

We've just added webpack 3.0.0 to our angular 2 project. I had it working, got about a 20-25% performance improvement and a 50% (ish) decrease in size. I then rebased this onto the main branch and started to get the error.

ERROR in chunk main [initial]
[name].bundle.js
Module \src\app\sales\models\index.ts has no static exports true

What does that error actually mean? I haven't been able to find anything useful online. Any tips on fixing it?

The \src\app\sales\models\index.ts file hasn't changed since my commit and only contains:

export * from './app-state';
export * from './purchase.model';
export * from './base.model';
export * from './view-state.model';
export * from './address';
export * from './core';
export * from './cover';
export * from './disclaimers';
export * from './family';
export * from './premium';
export * from './payments';
export * from './policy';
export * from './tracking.model';

After undoing my initial rebase I rebased the main on branch on top of my work and then found the commit that "broke" webpack (thank goodness for git bisect) and I'm in the process of slowly walking the changes back in to see if I can keep it working.

Looking at the webpack source the error is being thrown ConcatenatedModule.js in HarmonyImportSpecifierDependencyConcatenatedTemplate

    if(!Array.isArray(module.providedExports))
        throw new Error(`Module ${module.resource} has no static exports ${module.providedExports}`);

Some poking around has shown that module.providedExports is a boolean with a value of true, hence the error; however, I've not been able to workout what sets that value.

What does the error mean? Other debugging tips?

baralong
  • 1,644
  • 1
  • 16
  • 32

1 Answers1

0

I have this problem too. I don't know why this error is throws but i have fix it in replace '*' by explicit export.

for example :

before :

export * from './foo';
export * from './bar';

after :

export {Foo1, Foo2, /*...*/} from './foo';
export {Bar1, Bar2, /*...*/} from './bar'