Giter Club home page Giter Club logo

Comments (3)

antfu avatar antfu commented on May 30, 2024 1

The solution for css-loader feels a bit weird to me. But in Vite, the @import works the same as js modules without the ~ prefix to use modules. And the alias is also respected.

See:
https://vitejs.dev/guide/features.html#import-inlining-and-rebasing
https://github.com/postcss/postcss-import#usage

Thanks for bringing this up. As this is just a preference, I would keep going with ~/ for this template.

from vitesse.

antfu avatar antfu commented on May 30, 2024

Can you share the reference of using ~ for node_modules? I don't think it makes sense to me as by default you are already import modules from node_modules.

from vitesse.

Drumstix42 avatar Drumstix42 commented on May 30, 2024

Perhaps this is only a default for CSS styles actually.

E.g.

@import "~normalize/normalize.css";

Comment ref: webpack-contrib/css-loader#12 (comment)

I agree with that for JS it already defaults to node_modules when you don't specify a path.
So I guess I was just trying to avoid confusion with one case (CSS) targeting node_modules, and another case (this starter template and JS files) targeting the ./src directory.

This is just my opinion in the end, but I thought I would bring it up.

from vitesse.

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.