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

webpack项目无法使用 #1

Open
z-jack opened this issue Sep 24, 2019 · 8 comments
Open

webpack项目无法使用 #1

z-jack opened this issue Sep 24, 2019 · 8 comments

Comments

@z-jack
Copy link

z-jack commented Sep 24, 2019

重命名node_modules之后会导致报错“You attempted to import ../node_modules.nosync/css-loader/dist/runtime/api.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.”

@jctaoo
Copy link

jctaoo commented Jul 26, 2020

same problem !!

@haochuan9421
Copy link
Owner

可能项目的 webpack 配置中存在只针对 node_modules 的正则匹配,比如这种:

rules: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [
      {
        loader: "babel-loader",
        options: {},
      },
    ],
  },
],

如果是这样就得具体问题具体分析啦🤷‍♂️,暂时没想到通过工具解决的办法

@jctaoo
Copy link

jctaoo commented Jul 26, 2020

可能项目的 webpack 配置中存在只针对 node_modules 的正则匹配,比如这种:

rules: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [
      {
        loader: "babel-loader",
        options: {},
      },
    ],
  },
],

如果是这样就得具体问题具体分析啦🤷‍♂️,暂时没想到通过工具解决的办法

如果为 node_modules 下的每个文件夹使用 nosync 而不是 node_modules 本身是否有效?
@haochuan9421

@haochuan9421
Copy link
Owner

可能项目的 webpack 配置中存在只针对 node_modules 的正则匹配,比如这种:

rules: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [
      {
        loader: "babel-loader",
        options: {},
      },
    ],
  },
],

如果是这样就得具体问题具体分析啦🤷‍♂️,暂时没想到通过工具解决的办法

如果为 node_modules 下的每个文件夹使用 nosync 而不是 node_modules 本身是否有效?
@haochuan9421

理论上是的,但是别这样弄,一来文件太多,二来有些文件名也是有固定要求的,比如 node_modules/.cache 文件夹

@jctaoo
Copy link

jctaoo commented Jul 26, 2020

感谢你的回复🎉
就目前来看, 我的 icloud 似乎可以在较短时间同步完 create-react-app 项目中的 node_modules

@Caldis
Copy link

Caldis commented Feb 9, 2021

如果不用软链接, 改用硬链接或许可以规避这个问题, 即 ln -s 改为 ln

@guoyiheng
Copy link

可以尝试 pnpm

@jctaoo
Copy link

jctaoo commented Jun 6, 2021

可以尝试 pnpm

已经在用了,很不错,但似乎无法本质上避免node_module 黑洞。事实上,我已经放弃iCloud同步代码了😂

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

5 participants