Skip to content

Style with lang="scss" not working with vue compiler-sfc 3.5.12 #30

Open
@apichler-druck-at

Description

@apichler-druck-at

Hello!

Vue switched to sass "compileString" method instead of "renderSync" which breaks esbuild vue transpilation as soon as a style block with lang="scss" is present in an SFC.

https://github.com/vuejs/core/blob/main/CHANGELOG.md

vuejs/core@4474c11

Minimal example:

https://stackblitz.com/edit/stackblitz-starters-tyatq1?file=src%2FTest.vue

If lang="scss" is removed from Test.vue, transpilation works as expected with node esbuild.js

✘ [ERROR] Cannot read properties of undefined (reading 'replace') [plugin vue]

    src/Test.vue:1:25:
      1 │ ... {};import "/home/projects/stackblitz-starters-tyatq1/src/Test.v...
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onLoad" callback registered here:

    node_modules/esbuild-plugin-vue3/dist/index.js:338:34:
      338 │ ...                      build.onLoad({ filter: /.*/, namespace: ...
          ╵                                ~~~~~~

    at eval (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild-plugin-vue3/dist/index.js:338:35)
    at step (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild-plugin-vue3/dist/index.js:67:23)
    at Object.eval (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild-plugin-vue3/dist/index.js:48:53)
    at fulfilled (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild-plugin-vue3/dist/index.js:39:58)
    at <anonymous> (https://stackblitzstarterstyatq1-ktvm.w-credentialless-staticblitz.com/blitz.134daa3c.js:40:22853)

Error: Build failed with 1 error:
src/Test.vue:1:25: ERROR: [plugin: vue] Cannot read properties of undefined (reading 'replace')
    at failureErrorWithLog (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild/lib/main.js:1466:15)
    at eval (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild/lib/main.js:935:25)
    at eval (/home/projects/stackblitz-starters-tyatq1/node_modules/esbuild/lib/main.js:1344:9) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions