Closed GurovDmitriy closed 3 months ago
This error is expected. You're pulling in all assets here: https://github.com/GurovDmitriy/be-boilerplate-stack/blob/b1b3425bb839b5b3795d3c2f24f6638e6d00d4d0/vue-playground-default/src/shared/tools/ImageUrl.ts#L34
That makes ./src/shared/assets/styles/global.scss
to be imported in the bundle and given that you prepend @use './src/shared/assets/styles/global.scss' as *;
to all scss files, the error happens.
Can you give a solution? What does the helper for image paths have to do with it? why does the same structure work with nuxt3?
solved with
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "../src/shared/assets/styles/global.scss" as *;',
},
},
},
Describe the bug
The project defines scss files using @forward & @use, if there are any dependencies in the scss files, the development mode works, the build mode throws the Module has been loaded error. This happens even if you remove any dependencies in the scss files between each other and leave only 3 files main.scss, global.scss, _varables.scss. Help to correctly supply global.scss to component files without duplication. As I understand it, since the documentation does not contain a classic example of working with the system of preprocessor files, it means that the assembler cannot do this? This is strange in the era of new perfect tools.
Reproduction
https://github.com/BeautyLips/be-boilerplate-stack
Steps to reproduce
Use vue-playground-default boileplate Uncomment settings for vite config in field preprocessors. Comment handle @import "src/shared/assets/styles/global"; from files Run commands dev, build Pages Styles include examples using styles
System Info
Used Package Manager
npm
Logs
Click to expand!
```shell vite v5.2.11 building for production... ✓ 171 modules transformed. x Build failed in 1.49s error during build: Error: Module loop: this module is already being loaded. ╷ 1 │ @use './src/shared/assets/styles/global.scss' as *;@forward "core"; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ src\shared\assets\styles\global.scss 1:1 root stylesheet at Object.wrapException (C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:2161:43) at C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:86895:27 at _wrapJsFunctionForAsync_closure.$protected (C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:4900:15) at _wrapJsFunctionForAsync_closure.call$2 (C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:35566:12) at _awaitOnObject_closure.call$1 (C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:35554:32) at Object._rootRunUnary (C:\Users\ASUS\Desktop\development\project\be-boilerplate-stack\vue-playground-default\node_modules\sass\sass.dart.js:5295:18) at StaticClosure.Validations