Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lessLoaderOption.additionalData 不生效 #7921

Closed
neewbee opened this issue Oct 26, 2020 · 1 comment · Fixed by #8115
Closed

lessLoaderOption.additionalData 不生效 #7921

neewbee opened this issue Oct 26, 2020 · 1 comment · Fixed by #8115
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@neewbee
Copy link

neewbee commented Oct 26, 2020

相关平台

微信小程序

复现仓库

https://github.com/neewbee/taro-bug-less-loader-option-mini-lessLoaderOption
小程序基础库: 2.13.1
使用框架: React

复现步骤

npm run build:weapp

期望结果

编译成功

实际结果

> myApp@1.0.0 build:weapp /Users/neewbee/workspace/taro/myApp
> taro build --type weapp

👽 Taro v3.0.15

生成  工具配置  /Users/neewbee/workspace/taro/myApp/dist/project.config.json

编译  发现入口  src/app.js
编译  发现页面  src/pages/index/index.jsx
🙅   编译失败.

./src/app.less
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/less-loader/dist/cjs.js):


@import: "app.@{env}.less";
       ^
Variable @env is undefined
      in /Users/neewbee/workspace/taro/myApp/src/app.less (line 1, column 9)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myApp@1.0.0 build:weapp: `taro build --type weapp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myApp@1.0.0 build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/neewbee/.npm/_logs/2020-10-26T10_28_30_550Z-debug.log

环境信息

Taro CLI 3.0.15 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v12.18.2/bin/yarn
      npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
    npmPackages:
      @tarojs/components: 3.0.15 => 3.0.15
      @tarojs/mini-runner: 3.0.15 => 3.0.15
      @tarojs/react: 3.0.15 => 3.0.15
      @tarojs/runtime: 3.0.15 => 3.0.15
      @tarojs/taro: 3.0.15 => 3.0.15
      @tarojs/webpack-runner: 3.0.15 => 3.0.15
      babel-preset-taro: 3.0.15 => 3.0.15
      eslint-config-taro: 3.0.15 => 3.0.15
      react: ^16.10.0 => 16.14.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Oct 26, 2020
ZeroTo0ne added a commit to ZeroTo0ne/taro that referenced this issue Nov 24, 2020
@Chen-jj Chen-jj modified the milestones: 3.1.0, 3.0.26 Jan 28, 2021
Chen-jj added a commit that referenced this issue Jan 28, 2021
chore(taro-mini-runner): upgrade less-loader version to support additionalData config (#7921)
@Smi1e96
Copy link

Smi1e96 commented Feb 20, 2021

@Chen-jj 建议底层依赖项版本更新时 文档也注明 使用的版本,就比如现在less-loader更新到7版本 less配置文档就已经不合适了
less-loader@5:
image
less-loader@7:
image
例如 阻止滚动穿透

image
发版说明中也标识出来 😄 我一会提个PR修改下文档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
3 participants