GithubHelp home page GithubHelp logo

Comments (5)

shilman avatar shilman commented on September 27, 2024

That's awesome @justincy! Is there any way to decouple it, so that a user could install preset-typescript (possibly updated by you) and preset-css-modules (doesn't exist yet, you'd contribute it) and achieve the same result? Or could it not work that way?

from presets.

justincy avatar justincy commented on September 27, 2024

I'm not an expert in this area, but as far as I can tell, the existing preset-typescript is not compatible with Next. Next actually provides its own babel preset which is the easiest way to get TypeScript working for Next (it's included in the Storybook preset here). I think the issue with preset-typescript has to do with how Next doesn't require React to be imported in files that use JSX. For now I could create preset-next-typescript until someone with more expertise figures out whether there's a way to merge it into preset-typescript.

I see the benefit of creating the preset-css-modules. I guess there's no reason it needs to be coupled with preset-next-typescript.

from presets.

SpencerDuball avatar SpencerDuball commented on September 27, 2024

As far as not including preset-css-modules with the preset-next-typescript goes, Next 9.2 allows for css modules to be imported within the _app.(jsx|tsx) out-of-box. I think a seperate package for preset-css-modules would be nice for people with other applications, but having that preset as well included by default in any Next preset (typescript or javascript) might mitigate some headaches. That way the most manual work after installing a Next preset would be importing your global css files to something like the preview.js file in your gist.

Additionally, the _app.(jsx|tsx) file will always be in the same spot in a Next project's file hierarchy so maybe there is a small script that could scan for import statements ending with .css too?

from presets.

shilman avatar shilman commented on September 27, 2024

We have a specific preset for CRA that basically tries to reuse a users CRA settings to match their app setup as closely as possible, no matter the config (js, ts, etc). Iā€™m wondering whether the same thing might be possible for Next? Cc @mrmckeb

from presets.

mrmckeb avatar mrmckeb commented on September 27, 2024

So I was thinking about Next and Gatsby recently.

The problem is that both have plugin architectures, so we'd have to think about how we support those too - this is particularly important with Gatsby - which has a large plugin ecosystem.

That being said, I think we could support the 'defaults' with presets. We could also reach out to the maintainers and see if they'd be interested in supporting the presets - as ultimately that is a goal of presets I think (@shilman).

from presets.

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.