Giter VIP home page Giter VIP logo

Comments (7)

evanw avatar evanw commented on July 20, 2024 1

Thanks for the clarification. Please would you verify I am understanding you correctly, bundling is currently supported for assert by using --supported:import-assertions=true, and in the future (not ready yet) bundling will be supported for with by using --supported:import-attributes=true ?

Yes, that's correct. The reason assert "just works" with esbuild but with doesn't is because with can affect path resolution while assert can't (you can read more about that here). So the bundler basically ignore assert as it is mostly meaningless, but it can't ignore with.

from esbuild.

evanw avatar evanw commented on July 20, 2024

This is happening because esbuild doesn't currently implement bundling CSS imports that use the type: css import attribute (see #3384).

Did you mean to use --external:*.css to tell esbuild to not bundle these files?

from esbuild.

anilkumarum avatar anilkumarum commented on July 20, 2024

when i use assert keyword to import css, --loader:.css=copy work perfectly

esbuild style.js --bundle --minify --target=chrome123 --outfile=build/style.js --format=esm --loader:.css=copy

with is just replacement of assert for iimport css files
I expect --loader:.css=copy should work.

I also use --external:*.css but esbuild throw same error

Importing with a type attribute of "css" is not supported

    style.js:1:48:
       import styleCss from "./style.css" with { type: "css" };

please add support for with keyword same as assert

from esbuild.

evanw avatar evanw commented on July 20, 2024

Ah ok, so this is perhaps a request for with to work with the copy loader. That makes sense.

from esbuild.

mangelozzi avatar mangelozzi commented on July 20, 2024

I have this problem too, I used to use assert { type: "css" } but now the syntax has been deprecated for with { type: "css" }. Maybe in addition to the --supported:import-assertions=true ther should be a --supported:import-with=true flag?

from esbuild.

evanw avatar evanw commented on July 20, 2024

The name is import-attributes not import-with because the syntax is called import attributes. You can find the full list of feature names that can be used with --supported in esbuild's documentation: https://esbuild.github.io/api/#supported

However, enabling support for the with syntax doesn't do anything in this case. The problem is that bundling isn't supported yet, not that the syntax isn't supported.

from esbuild.

mangelozzi avatar mangelozzi commented on July 20, 2024

The name is import-attributes not import-with because the syntax is called import attributes. You can find the full list of feature names that can be used with --supported in esbuild's documentation: https://esbuild.github.io/api/#supported

However, enabling support for the with syntax doesn't do anything in this case. The problem is that bundling isn't supported yet, not that the syntax isn't supported.

Thanks for the clarification. Please would you verify I am understanding you correctly, bundling is currently supported for assert by using --supported:import-assertions=true, and in the future (not ready yet) bundling will be supported for with by using --supported:import-attributes=true ?

I am super excited and waiting for cause this cause I was forced to move to with, but now my build step is no longer working correctly. Cheers!

from esbuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.