Giter Club home page Giter Club logo

Comments (5)

glromeo avatar glromeo commented on May 30, 2024

HI @58bits my plugin already uses resolve for sass imports

function requireResolve({ resolveDir, path }) {
const paths = options.includePaths ? [resolveDir, ...options.includePaths] : [resolveDir];
return require.resolve(path, { paths });
}

but it might be that your layout doesn't work with require defaults... try and pass an includePaths that points to your node_modules, something like this:
plugins: [sassPlugin({
type: "style",
includePaths: [path.resolve(__dirname, "fixture/bootstrap")]
})]

from esbuild-sass-plugin.

58bits avatar 58bits commented on May 30, 2024

Hi @glromeo - thanks very much for taking the time to reply. I've tried updating sassPlugin settings as you've described above, but I'm still getting error: [sass-plugin] Can't find stylesheet to import

I'm new to esbuild, and so it's highly likely I've setup something incorrectly.

I've created a test repo here... https://github.com/58bits/esbuild-test

Can you see anything obviously wrong with this?

from esbuild-sass-plugin.

58bits avatar 58bits commented on May 30, 2024

Hi - I've updated the test repo at https://github.com/58bits/esbuild-test

I've fixed up all @use statements, and changed the build directory and project structure. I'm also using the ~ syntax to specify material modules - and this works, but then there are sub modules, or dependencies that fail.

I'm only attempting to import one component - via src/styles/components/_year-select.scss

And I'm getting the following error:

 > src/index.js:1:7: error: [sass-plugin] Can't find stylesheet to import.
   ╷
23 │ @use '@material/feature-targeting/feature-targeting';
   │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  node_modules/@material/select/_select-helper-text-theme.scss 23:1  @forward
  node_modules/@material/select/_index.scss 23:1                     @use
  src/styles/components/_year-select.scss 2:1                        @use
  src/styles/style.scss 3:1                                          root stylesheet
      1 │ import './styles/style.scss'

from esbuild-sass-plugin.

glromeo avatar glromeo commented on May 30, 2024

@58bits

According to https://github.com/material-components/material-components-web/tree/master/packages/mdc-select
you have to change your _year-select.scss to:

@use "../config/config" as *;

@use "~@material/list/mdc-list";
@use "~@material/menu-surface/mdc-menu-surface";
@use "~@material/menu/mdc-menu";
@use "~@material/select/styles";
@use '~@material/select';

.mdc-select--filled:not(.mdc-select--disabled) .mdc-select__anchor {
  background-color: $dashboard-panel-background-color;
}
...

then in build.js just use this setup for esbuild-sass-plugin:

  plugins: [sassPlugin({
    type: "style", 
    includePaths: [
      path.resolve(__dirname, "node_modules"),
    ] 
  })],

from esbuild-sass-plugin.

58bits avatar 58bits commented on May 30, 2024

Oh that's fantastic. It's working. Thank you so much. path.resolve(__dirname, "node_modules"), what what I needed.

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.