GithubHelp home page GithubHelp logo

Comments (8)

doronoded avatar doronoded commented on August 16, 2024 2

Hey, I figured it out..
You can use
fs.realpathSync("../../node_modules/@project/comp-one")
instead of
path.resolve("../../node_modules/@project/comp-one")

It solved my problem.

from customize-cra.

doronoded avatar doronoded commented on August 16, 2024 1

Yes, its because its a seemlink!
Any suggestions?

from customize-cra.

doronoded avatar doronoded commented on August 16, 2024

Could it be because shared-lib is a local folder with a symlink?

from customize-cra.

andre-engelbrecht avatar andre-engelbrecht commented on August 16, 2024

Same problem. I'm adding a path to a symlink and it does not seem to get transpiled.

config-override.js:

const { override, babelInclude } = require("customize-cra");
const path = require("path");

module.exports = override(
  babelInclude([
    path.resolve("src"), // make sure you link your own source
    path.resolve("../../node_modules/@project/comp-one")
  ])
);

Error:

...\comp-one\src\index.js: Unexpected token (3:22)

  1 | import React from 'react';
  2 | 
> 3 | const CompOne = () => <div>
    |                       ^
  4 |     <h3>CompOne</h3>
  5 |     <p><i>Transpiled On-The-Fly</i></p>

Help would be appreciated!

from customize-cra.

FezVrasta avatar FezVrasta commented on August 16, 2024

May you try with removeModuleScopePlugin()? I'm not sure it will help but it's worth a shot.

from customize-cra.

andre-engelbrecht avatar andre-engelbrecht commented on August 16, 2024

Hi, I tried all of the options below:

const {
  override,
  overrideDevServer,
  disableEsLint,
  watchAll,
  removeModuleScopePlugin
} = require("customize-cra");

module.exports = {
  // webpack: override(
  //   removeModuleScopePlugin,
  //   watchAll()
  // ),
  // devServer: overrideDevServer(
  //   removeModuleScopePlugin,
  //   watchAll()
  // )
  removeModuleScopePlugin
};

Still get the same issue, code is not transpiled. If I manually transpile with babel it works, so I know that's the problem.

from customize-cra.

andre-engelbrecht avatar andre-engelbrecht commented on August 16, 2024

YES, it works. Thanks @doronoded !

from customize-cra.

doronoded avatar doronoded commented on August 16, 2024

wrote a blog post about this:
https://medium.com/capriza-engineering/sharing-source-code-and-libraries-in-react-bd30926df312

from customize-cra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.