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

Error: 'default' is not exported by node_modules/single-spa-html/lib/single-spa-html.js #17

Open
marcosgilf opened this issue Nov 22, 2021 · 2 comments

Comments

@marcosgilf
Copy link

marcosgilf commented Nov 22, 2021

Hi!

I'm using single-spa-html as stated in https://single-spa.js.org/docs/ecosystem-html-web-components/#via-npm:

import singleSpaHtml from 'single-spa-html';

const htmlLifecycles = singleSpaHtml({
  template: '<x-my-web-component></x-my-web-component>',
})

export const bootstrap = htmlLifecycles.bootstrap;
export const mount = htmlLifecycles.mount;
export const unmount = htmlLifecycles.unmount;

And I'm using rollup to create the bundle with this config:

import { nodeResolve } from '@rollup/plugin-node-resolve';

export default {
  input: 'src/app.js',
  output: {
    dir: 'dist',
    format: 'system',
  },
  plugins: [nodeResolve()],
};

When I run rollup I get this output:

> rollup --config rollup.config.js


src/app.js → dist...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/single-spa-html/lib/single-spa-html.js
11:     global.singleSpaHtml = mod.exports;
12:   }
13: })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
                                                                                             ^
14:   "use strict";
[!] Error: 'default' is not exported by node_modules/single-spa-html/lib/single-spa-html.js, imported by src/app.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module

Any idea of what am I doing wrong? or if there is some rollup config that can undestand the single-spa-html export file?

Thanks!

@wynnerd
Copy link

wynnerd commented Mar 23, 2022

Did you ever find out what was up with this? I'm seeing something very similar regarding this file in my builds. Not using rollup though.

@marcosgilf
Copy link
Author

No news 😞

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