Giter Club home page Giter Club logo

Comments (9)

tadman avatar tadman commented on June 8, 2024 1

For clarification, it's cssImports.

from esbuild-sass-plugin.

glromeo avatar glromeo commented on June 8, 2024

your issue is likely a css import (i.e. not sass) being tried to be resolved by esbuild …I can’t just see that import in formio so if can’t tell more than that… I am happy to help you troubleshoot this but you have to come up with a github repo where you reproduce the issue

from esbuild-sass-plugin.

alex-w0 avatar alex-w0 commented on June 8, 2024

Yes true, it's a common css import which should recognize the tilde as an alias for the node_modules. The formio file just contains the import statement at the beginning. Here is the repo for reproducing the issue.

from esbuild-sass-plugin.

glromeo avatar glromeo commented on June 8, 2024

the issue here is that sass doesn’t call the plugin importer because it’s a css so the import ends in the css that esbuild is trying to bundle and esbuild has no idea how to deal with ~ indeed if you remove ~ from your example url it builds just fine

from esbuild-sass-plugin.

glromeo avatar glromeo commented on June 8, 2024

another option for you is to use the precompile in the plugin to change the url and remove the ~

from esbuild-sass-plugin.

glromeo avatar glromeo commented on June 8, 2024

I’m on holidays with just an ipad when back I want to try and add another onResolve to the plugin to male life easier in these situations

the idea is the following

var esbuild = require('esbuild');
var esbuildSass = require('esbuild-sass-plugin');

esbuild
  .build({
    entryPoints: ['./src/formio.scss'],
    bundle: true,
    outdir: './css',
    plugins: [esbuildSass.sassPlugin(),
       {name:"temp",setup(build){
      build.onResolve({filter:/^~.*css$/},({path})=>{
        return {path: require.resolve(path.slice(1))}
      })
    }}],
    
  })
  .catch(() => {
    process.exit(1);
  });

from esbuild-sass-plugin.

alex-w0 avatar alex-w0 commented on June 8, 2024

I’m on holidays with just an ipad when back I want to try and add another onResolve to the plugin to male life easier in these situations

the idea is the following

var esbuild = require('esbuild');
var esbuildSass = require('esbuild-sass-plugin');

esbuild
  .build({
    entryPoints: ['./src/formio.scss'],
    bundle: true,
    outdir: './css',
    plugins: [esbuildSass.sassPlugin(),
       {name:"temp",setup(build){
      build.onResolve({filter:/^~.*css$/},({path})=>{
        return {path: require.resolve(path.slice(1))}
      })
    }}],
    
  })
  .catch(() => {
    process.exit(1);
  });

Yes no worry, writing the full path works fine for me, so this improvement is not really urgent or even tragic when it's not possible. Enjoy your holidays.

from esbuild-sass-plugin.

glromeo avatar glromeo commented on June 8, 2024

@alex-w0 you can upgrade to 2.2.4 and add cssImports: true to your options
thank you for your example repo!

from esbuild-sass-plugin.

alex-w0 avatar alex-w0 commented on June 8, 2024

Thanks works great 🚀 I also didn't know that the ~ is deprecated these days ^^

from esbuild-sass-plugin.

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.