Giter VIP home page Giter VIP logo

Comments (4)

risen228 avatar risen228 commented on July 28, 2024 3

@cliffordfajardo @Octopixell check option unsafeAllowModulesOutsideOfSrc in release 3.0.0

from craco-alias.

cliffordfajardo avatar cliffordfajardo commented on July 28, 2024 1

I ended up using react-app-rewire-alias

My config-overrides.js file looks like this

/**
 * This file is required by `react-app-rewired` to override or make additions to webpack.
 * `react-app-rewired` allows us to make modifications & extend `create-react-app` without ejecting.
 * This allows us to get upstream updates, bug fixes, best practices baked in and improvements
 * from the react team & open source community.
 * - https://github.com/timarney/react-app-rewired/
 */
const {aliasDangerous, configPaths} = require('react-app-rewire-alias/lib/aliasDangerous');
// const fs = require('fs'); useful for debugging; see commented out fs function call(s) below

module.exports = {
  /**
   * @description
   * The Webpack config to use when compiling your react app for development or production
   * @param {Object} config 
   * @param {string} env - the environment variable passed to node on start.
   * https://github.com/timarney/react-app-rewired#1-webpack-configuration---development--production
   */
  webpack: function(config, env) {
    aliasDangerous({
      ...configPaths('tsconfig.overrides.json'),
    })(config)
    // fs.writeFileSync('debug-config.json', JSON.stringify(config, null, 2)) Uncomment to view see the output for debugging
    return config;  
  },
}

My ts-config-overrides.json file looks like this:

ts-config-overrides.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "theme": ["./src/theme/*"],	
      "pages": ["./src/pages/*"],	
      "lib": ["./src/lib/*"],	
      "components": ["./src/components/*"],	
      "@shared/*": ["../shared/src/*"]
    },
    "isolatedModules": false
  },
  "references": [
    {
      "path": "../shared"
    }
  ]
}

tsconfig.json

{
  "compilerOptions": {
    "module": "CommonJS",
  },
  "exclude": ["**/node_modules/**"]
}

from craco-alias.

Octopixell avatar Octopixell commented on July 28, 2024

I've ran into the exact same issue unfortunately. Did you manage to find a solution for this @cliffordfajardo ?

from craco-alias.

risen228 avatar risen228 commented on July 28, 2024

Yeah, this is the CRA restriction. The plugin doesn't remove it; I'll think about adding this feature.

from craco-alias.

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.