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

2.1.x在编译同名sass文件时会产生报错 #5945

Closed
aoarashi1988 opened this issue Apr 10, 2020 · 4 comments
Closed

2.1.x在编译同名sass文件时会产生报错 #5945

aoarashi1988 opened this issue Apr 10, 2020 · 4 comments
Assignees

Comments

@aoarashi1988
Copy link

问题描述

如果同一文件引用了不同路径但是同文件名的scss文件,编译后会有命名冲突

复现步骤

在原始文件中形如:

import './index.scss';
import '../index.scss';

在编译成RN文件的中间过程中,会被解析成

import indexScss from '../index.scss';
import indexScss from './index.scss';

就会有命名冲突的问题,导致编译失败

期望行为

能正常编译不报错

报错信息

Module build failed (from ./node_modules/@tarojs/rn-runner/dist/loaders/babelLoader.js):
TypeError: unknown: Duplicate declaration "indexScss"
   7 | 
   8 | import indexScss from '../index.scss';
>  9 | import indexScss from './index.scss';
     |        ^
  10 | var _styleSheet = BarItemStyleSheet;
  11 | 
  12 | function _getClassName() {

系统信息

Taro CLI 2.1.3 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 10.15.3 - D:\Program Files\NodeJs\node.EXE
      Yarn: 1.22.0 - C:\Users\dodol\AppData\Roaming\npm\yarn.CMD
      npm: 6.13.4 - D:\Program Files\NodeJs\npm.CMD

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Apr 10, 2020

CC @Pines-Cheng

@taro-bot
Copy link

taro-bot bot commented Apr 10, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@lonquan
Copy link

lonquan commented Apr 10, 2020

唉, 我弃坑了..

@Pines-Cheng
Copy link
Contributor

Pines-Cheng commented Apr 16, 2020

2.1.x 的 RN 编译刚经过重构,可能会有一些点有问题。

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

No branches or pull requests

3 participants