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

Unable to import * from csstips using rollup #13

Open
kellycampbell opened this issue Jul 26, 2019 · 1 comment
Open

Unable to import * from csstips using rollup #13

kellycampbell opened this issue Jul 26, 2019 · 1 comment

Comments

@kellycampbell
Copy link

I'm trying to use csstips in a server-side rendered app. The same import style doesn't work for both.

When I use the following in a .tsx file:

import * as csstips from 'csstips';
import * as csx from 'csx';

the resulting rollup js for csstips is this:

    var csstips = /*#__PURE__*/Object.freeze({
        default: index,
        __moduleExports: lib
    });

and the generated code has undefined where I use csstips functions:

style(csstips.vertical, csstips.centerJustified, csstips.width(450))

in the original .tsx file becomes the following in the rolled up js:

style(undefined, undefined(percent(100)), undefined(percent(100))

causing an error like TypeError: undefined is not a function


Changing the import style to this fixes the problem for the browser, but doesn't work for the server side:

import csstips from 'csstips';
import * as csx from 'csx';

The csx imports work for both SSR and browser however.

Note: I originally reported this issue here as I thought it was a tool problem unrelated to the csstips library code: bazelbuild/rules_nodejs#933

@brandoncc
Copy link

I just ran into this on webpack with babel 7 as well. Unfortunately your fix didn't work for me.

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