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

Bug: importing CSS props with postcss will throw error for: missed semicolon #191

Closed
GrimLink opened this issue Sep 13, 2023 · 2 comments
Closed
Assignees
Labels

Comments

@GrimLink
Copy link
Member

This is caused by the export rules, for example with @fylgja/sizes package.json there is an explicit export rule for specific files:

{
  "name": "@fylgja/sizes",
  ...
  "type": "module",
  "main": "index.cjs",
  "unpkg": "sizes.css",
  "style": "sizes.css",
  "module": "index.js",
  "exports": {
    ".": {
      "import": "./index.js",
      "require": "./index.cjs",
      "default": "./index.cjs"
    }
  },
  ...
}

Sadly the style export rule is not used when combined with the exports export rule.

To resolve this, the css export needs used as the default export option in exports export rule until postcss adds support for this, see: postcss/postcss-import#492
or Fylgja needs a second export option for CSS

@GrimLink GrimLink added the bug label Sep 13, 2023
@GrimLink GrimLink changed the title Bug: importing CSS props with postcss will trow error missing semicolon Bug: importing CSS props with postcss will throw error for: missed semicolon Sep 13, 2023
@GrimLink
Copy link
Member Author

GrimLink commented Sep 13, 2023

After conducting tests within the https://github.com/fylgja/examples environment, we successfully resolved the issue by setting the default preference to the CSS file. Given that Fylgja prioritizes CSS as its primary focus, we intend to establish a default rule for scenarios where both CSS and JS coexist in the same location, giving precedence to CSS exports.

@GrimLink GrimLink added the In Progress This Issue has been picked up by the assigned users label Sep 14, 2023
@GrimLink GrimLink added the research Needs further investigation label Oct 10, 2023
@GrimLink
Copy link
Member Author

Fixed in v1.3.4

This had been tested with node 16 and vite v4.2 using Fylgja v1.3.4 in our examples repo Fylgja Examples - Vite PostCSS.
The style export option in the exports of the package.json is used when added before the import and require.

For an example see the Fylgja Sizes component package.json

@GrimLink GrimLink removed research Needs further investigation In Progress This Issue has been picked up by the assigned users labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants