vue@2.x引入sass模块

本文介绍了如何在Vue 2.x项目中添加对Sass的支持,通过安装node-sass@4.14.1和sass-loader@7.3.1这两个依赖,开发者可以方便地使用Sass进行样式编写和编译。

vue @2.5.2 版本引入sass模块

需要安装下面两个依赖:
1、node-sass @4.14.1
2、sass-loader @7.3.1

安装node-sass @4.14.1
npm install node-sass@4.14.1

安装sass-loader @7.3.1
npm i -D sass-loader@7.3.1

pnpm run build > vue_demo1@0.0.0 build /Users/zhangsonglan/web/launcher_web > run-p type-check "build-only {@}" -- > vue_demo1@0.0.0 type-check /Users/zhangsonglan/web/launcher_web > vue-tsc --build --force > vue_demo1@0.0.0 build-only /Users/zhangsonglan/web/launcher_web > vite build failed to load config from /Users/zhangsonglan/web/launcher_web/vite.config.ts error during build: ReferenceError: require is not defined in ES module scope, you can use import instead at file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite-plugin-prerender@1.0.8_vite@5.4.19_@types+node@20.19.9_sass@1.89.2_/node_modules/vite-plugin-prerender/dist/index.mjs:6:21 at ModuleJob.run (node:internal/modules/esm/module_job:262:25) at async ModuleLoader.import (node:internal/modules/esm/loader:474:24) at async loadConfigFromBundledFile (file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite@5.4.19_@types+node@20.19.9_sass@1.89.2/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:66958:15) at async loadConfigFromFile (file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite@5.4.19_@types+node@20.19.9_sass@1.89.2/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:66799:24) at async resolveConfig (file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite@5.4.19_@types+node@20.19.9_sass@1.89.2/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:66399:24) at async build (file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite@5.4.19_@types+node@20.19.9_sass@1.89.2/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:65487:18) at async CAC.<anonymous> (file:///Users/zhangsonglan/web/launcher_web/node_modules/.pnpm/vite@5.4.19_@types+node@20.19.9_sass@1.89.2/node_modules/vite/dist/node/cli.js:829:5)  ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed. ERROR: "build-only" exited with 1.  ELIFECYCLE  Command failed with exit code 1.
08-05
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DevilAngelia

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值