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

taro3.6.2 webpack5 环境下,这个插件和 terser-webpack-plugin一起使用,会导致插件转义功能失效 #142

Closed
huanlirui opened this issue Mar 7, 2023 · 14 comments
Assignees
Labels
question Further information is requested

Comments

@huanlirui
Copy link

你有什么想问的可以写在这
比如 使用 bg-sky-500/100
image
报错:
image

@huanlirui huanlirui added the question Further information is requested label Mar 7, 2023
@sonofmagic
Copy link
Owner

好的,我待会下班复现一下

@sonofmagic
Copy link
Owner

你能把具体报错的那一块 wxss 也截取出来吗?还有你的 taro版本,用的 webpack版本啥的,这样我可以在复现时候保证环境一致。

@huanlirui
Copy link
Author

额,我看这个是通病。其他类似的tailwind插件都是一样有这个问题。

 Taro v3.6.2


  Taro CLI 3.6.2 environment info:
    System:
      OS: macOS 12.5
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v19.3.0/bin/yarn
      npm: 9.2.0 - ~/.nvm/versions/node/v19.3.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.2 => 3.6.2 
      @tarojs/components: 3.6.2 => 3.6.2 
      @tarojs/helper: 3.6.2 => 3.6.2 
      @tarojs/plugin-framework-react: 3.6.2 => 3.6.2 
      @tarojs/plugin-html: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-alipay: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-h5: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-jd: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-qq: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-swan: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-tt: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-weapp: 3.6.2 => 3.6.2 
      @tarojs/react: 3.6.2 => 3.6.2 
      @tarojs/runtime: 3.6.2 => 3.6.2 
      @tarojs/shared: 3.6.2 => 3.6.2 
      @tarojs/taro: 3.6.2 => 3.6.2 
      @tarojs/webpack5-runner: 3.6.2 => 3.6.2 
      babel-preset-taro: 3.6.2 => 3.6.2 
      eslint-config-taro: 3.6.2 => 3.6.2 
      react: ^18.0.0 => 18.2.0 

@sonofmagic
Copy link
Owner

我试了一下,bg-sky-500/80 我看是被转化成 :

.bg-sky-500_s_80 {
    background-color: rgb(14 165 233 / 0.8)
}

并没有报错,你能把你报错的 wxss 片段发上来吗?

@huanlirui
Copy link
Author

我试了一下,bg-sky-500/80 我看是被转化成 :

.bg-sky-500_s_80 {
    background-color: rgb(14 165 233 / 0.8)
}

并没有报错,你能把你报错的 wxss 片段发上来吗?

image

怎么 看 `wxss` 片段 ?

@sonofmagic
Copy link
Owner

dist 目录下,查看 app.wxss 文件,然后报错信息上不是告诉你多少行,多少列吗,跳转到那里看看到底是什么导致的报错。

@huanlirui
Copy link
Author

huanlirui commented Mar 8, 2023

image

@sonofmagic
Copy link
Owner

你好啊,你用的 weapp-tailwindcss-webpack-plugin 版本是啥,似乎注册的有问题, TaroWeappTailwindcssWebpackPluginV5 没有顺利注册的样子,导致没有转化wxss和wxml。

@huanlirui
Copy link
Author

你好啊,你用的 weapp-tailwindcss-webpack-plugin 版本是啥,似乎注册的有问题, TaroWeappTailwindcssWebpackPluginV5 没有顺利注册的样子,导致没有转化wxss和wxml。

"weapp-tailwindcss-webpack-plugin": "^1.12.8",
"webpack": "^5.74.0"

@sonofmagic
Copy link
Owner

config/index.js 里注册了吗,你要不加我微信吧,看看到底是啥问题,方式就在我的 github首页

@huanlirui
Copy link
Author

config/index.js 里注册了吗,你要不加我微信吧,看看到底是啥问题,方式就在我的 github首页

好的大佬

@sonofmagic sonofmagic changed the title taro 中使用 / 斜杠的语法 会导致报错 taro3.6.2 webpack 中这个插件和 taro-plugin-compiler-optimization 一起使用,会导致插件转义功能 失效 Mar 8, 2023
@sonofmagic sonofmagic changed the title taro3.6.2 webpack 中这个插件和 taro-plugin-compiler-optimization 一起使用,会导致插件转义功能 失效 taro3.6.2 webpack5 环境下,这个插件和 taro-plugin-compiler-optimization一起使用,会导致插件转义功能失效 Mar 8, 2023
@huanlirui huanlirui changed the title taro3.6.2 webpack5 环境下,这个插件和 taro-plugin-compiler-optimization一起使用,会导致插件转义功能失效 taro3.6.2 webpack5 环境下,这个插件和 terser-webpack-plugin一起使用,会导致插件转义功能失效 Mar 8, 2023
@huanlirui
Copy link
Author

image

与此插件冲突,去掉该配置,即可正常使用

@HongxuanG
Copy link

image

与此插件冲突,去掉该配置,即可正常使用

但是我代码要压缩呀

@sonofmagic
Copy link
Owner

代码压缩,直接使用 taro 的压缩配置就行了,

这个 issue 当时是和外部额外安装的 terser 插件出现了问题,和 taro 内部的 terser 就能正常跑了,

而且可能在新的版本里,这个问题已经被修复了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants