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

Don't include parser in the bundle #49

Closed
3 tasks done
satya164 opened this issue Aug 27, 2017 · 6 comments
Closed
3 tasks done

Don't include parser in the bundle #49

satya164 opened this issue Aug 27, 2017 · 6 comments
Assignees
Labels
priority: critical ☢️ Issue is a critical bug that affects most of the users
Milestone

Comments

@satya164
Copy link
Member

satya164 commented Aug 27, 2017

Since we pre-evaluate all css code during build time, we don't need to include the css tag and the CSS parser in the bundle. To reduce the bundle size, we can:

  • Rewrite the import for css with a function that throws an error
  • Rewrite the import for include with a function that throws an error
  • Rewrite imports like import { names } from 'linaria' to import names from 'linaria/build/names'
@satya164 satya164 modified the milestone: Version 0 Aug 27, 2017
@zamotany zamotany added the priority: critical ☢️ Issue is a critical bug that affects most of the users label Aug 28, 2017
@zamotany
Copy link
Contributor

I would leave the 2nd point to the external plugin if the user wants it.

@satya164
Copy link
Member Author

I would leave the 2nd point to the external plugin if the user wants it.

If we don't do that, the parser will probably be included as tree-shaking doesn't happen with commonjs.

@zamotany
Copy link
Contributor

what parser??

@satya164
Copy link
Member Author

stylis

@zamotany
Copy link
Contributor

({
  css: require('linaria/build/css.dummy'),
  include: require('linaria/build/include.dummy'),
  names: require('linaria/build/names'),
})

@satya164
Copy link
Member Author

replace require('linaria') or import { css } from 'linaria' with require('linaria/build/alternate') or import { css } from 'linaria/build/alternate'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: critical ☢️ Issue is a critical bug that affects most of the users
Projects
None yet
Development

No branches or pull requests

2 participants