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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

@parcel/transformer-css: Unexpected token Semicolon #9577

Closed
caleb-at-pieces opened this issue Mar 12, 2024 · 2 comments
Closed

@parcel/transformer-css: Unexpected token Semicolon #9577

caleb-at-pieces opened this issue Mar 12, 2024 · 2 comments

Comments

@caleb-at-pieces
Copy link

caleb-at-pieces commented Mar 12, 2024

馃悰 bug report

I have an internal package which uses tailwindcss, and some simple updates to it seem to have led to issues in the css transformation pipeline within parcel. Now whenever I build my app I am getting 'unexpected token semicolon':

馃帥 Configuration (.babelrc, package.json, cli command)

//tailwind.config.js
module.exports = {
  content: [
    './src/**/*.{html,js,ts,jsx,tsx}',
    './node_modules/@pieces.app/pieces-copilot-plugin/dist/**/*.{html,js,ts,jsx,tsx}',
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};
// .postcssrc.js
module.exports = {
  "plugins": {
    "tailwindcss": {},
    'postcss-import': require('postcss-import'),
    'postcss-url': { url: 'inline' },
  }
}
// .parcelrc
{
"extends": "@parcel/config-default",
"optimizers": { "*.svg": [] }
}
# built with this command:
npx parcel src/index.html

馃 Expected Behavior

I would expect that the build would not fail (not too much changed in terms of my adding css). This package is working fine in other projects that I have.

馃槸 Current Behavior

after attempting to build the package it is giving me this error
image

馃拋 Possible Solution

Looking at the class that it is creating it might be how I am applying my css variables in tailwind classes that is causing this issue such as:

element.classList.add('focus:border-[var(--text-accent)]')

馃敠 Context

After updating my package to a newer version it is now failing to build, previous versions work fine.

馃捇 Code Sample

I can't right now as it is a private npm package but we may be able to set something up.

馃實 Your Environment

as mentioned earlier I am using tailwindcss and postcss in order to build my css file. My project is a front end that is written purely in typescript (no framework such as react).

I have used this package extensively in other environments without issue, however I did just get started on a newer integration I am not as familiar with so it may be something that I have missed. (this is the only one built with parcel, the rest have esbuild / postcss as their pipelines)

Software Version(s)
Parcel 2.9.3
Node 20.3.0
npm/Yarn npm 9.6.7
Operating System macos sonoma 14.3.1
@mischnic
Copy link
Member

mischnic commented Apr 5, 2024

Parcel's CSS handling got stricter at some point after switching to Lightning CSS

I think that is just invalid CSS?

If you can't/don't want to fix this, you could set errorRecovery to silence that error: parcel-bundler/website#1071

@caleb-at-pieces
Copy link
Author

Parcel's CSS handling got stricter at some point after switching to Lightning CSS

I think that is just invalid CSS?

If you can't/don't want to fix this, you could set errorRecovery to silence that error: parcel-bundler/website#1071

Yes I think you are correct. I don't think the issue is in parcel or lightningcss but potentially it is auto prefixer that is adding that invalid css into the bundle.

I went back and saw in my other projects that that css rule is still present however the css bundling steps just end up ignoring the error.

Thx for the response.

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