I have a new project with laravel 8.
If I use the sass preprocessor in the webpack.mix.js file:
mix.js('resources/js/app.js', 'public/js')
.vue()
.sass('resources/sass/app.scss', 'public/css');
then the compilation of the code during the execution of the npm run watch command proceeds without errors.
but if I change the preprocessor to post "postcss" in webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
.vue()
.postCss('resources/sass/app.scss', 'public/css');
errors occur during compilation.
ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
SyntaxError
(1:1) C:\Users\webgr\laravel-dev\vue.loc\resources\sass\app.scss Unknown word
> 1 | import api from "!../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js";
| ^
2 | import content from "!!../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-12[0].rules[0].use[1]!../../node_modules/postcss-loade
r/dist/cjs.js??clonedRuleSet-12[0].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-12[0].rules[0].use[3]!./app.scss";
3 |
at processResult (C:\Users\webgr\laravel-dev\vue.loc\node_modules\webpack\lib\NormalModule.js:598:19)
at C:\Users\webgr\laravel-dev\vue.loc\node_modules\webpack\lib\NormalModule.js:692:5
at C:\Users\webgr\laravel-dev\vue.loc\node_modules\loader-runner\lib\LoaderRunner.js:399:11
at C:\Users\webgr\laravel-dev\vue.loc\node_modules\loader-runner\lib\LoaderRunner.js:251:18
at context.callback (C:\Users\webgr\laravel-dev\vue.loc\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at Object.loader (C:\Users\webgr\laravel-dev\vue.loc\node_modules\postcss-loader\dist\index.js:94:7)
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 2 errors
But I need to include in the my project "Tailwindcss" it needs the "postcss" preprocessor. This is what the Tailwindcss documentation says.
What can be done to correct these errors?
.sass('resources/sass/app.scss', 'public/css', [ require("tailwindcss"), ]);?