Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Angular 2 'default' is not exported by module #169

Closed
chancock-handy opened this issue Feb 23, 2017 · 2 comments
Closed

Angular 2 'default' is not exported by module #169

chancock-handy opened this issue Feb 23, 2017 · 2 comments

Comments

@chancock-handy
Copy link

chancock-handy commented Feb 23, 2017

I'm trying to get Angular Universal up and running with rollup but its proving very difficult.

server: {
    options: {
      entry: "./app/server.ts",
      plugins: [
        nodeBuiltins(),
        typescript(),
        resolve({
          jsnext: true,
          browser: true,
          main: true,
        }),
        commonjs({
          exclude: ["node_modules/rollup-plugin-node-globals/**"],
          include: "node_modules/**",
        }),
        nodeGlobals(),
      ],
    },
    files: {
      "dist/server.js": "app/server.ts",
    },
  },

The file builds, but with a swath of errors about default exports.

node_modules/@angular/core/index.js (1:157) 'default' is not exported by 'node_modules/@angular/core/index.js'
node_modules/@angular/http/index.js (1:157) 'default' is not exported by 'node_modules/@angular/http/index.js'
node_modules/@angular/platform-browser-dynamic/index.js (1:177) 'default' is not exported by 'node_modules/@angular/platform-browser-dynamic/index.js'
node_modules/@angular/platform-browser/index.js (1:169) 'default' is not exported by 'node_modules/@angular/platform-browser/index.js'
node_modules/@angular/common/index.js (1:159) 'default' is not exported by 'node_modules/@angular/common/index.js'
node_modules/rollup-plugin-node-builtins/src/es6/http.js (1:175) 'default' is not exported by 'node_modules/rollup-plugin-node-builtins/src/es6/http.js'
node_modules/@angular/compiler/index.js (1:161) 'default' is not exported by 'node_modules/@angular/compiler/index.js'
node_modules/preboot/__dist/preboot_browser.js (1:198) 'default' is not exported by 'node_modules/preboot/__dist/preboot_browser.js'

I know they're related to the commonjs plugin, but I can't make any headway removing them. No luck with named_exports or plugin ordering.

Any advice would be greatly appreciated

Related:

#44
#137
rollup/rollup#524

@Rich-Harris
Copy link
Contributor

My hunch is that this is a manifestation of rollup/rollup#1148 — could you try putting nodeBuiltins and typescript after commonjs in your plugins array?

@chancock-handy
Copy link
Author

As far as I could tell, it was the known dependency issues in addition to some problems with typescript and the node plugins playing together. It ended up being easier using a simple webpack config for the server.

Thanks for all the hard work on the plugin! Its amazing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants