timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.77k stars 425 forks source link

Problem with the build. #556

Closed vladyslavsokulskyiempeek closed 2 years ago

vladyslavsokulskyiempeek commented 3 years ago

Project structure contains functions folder (for firebase functions) in core project folder. I need import function from functions/generateData/generateDataForFile.js

config-overrides.js

  const { alias, aliasJest, configPaths } = require('react-app-rewire-alias');

  const aliasMap = configPaths('./jsconfig.paths.json');

  module.exports = alias(aliasMap);
  module.exports.jest = aliasJest(aliasMap);

jsconfig.paths.json

    {
      "compilerOptions": {
        "baseUrl": ".",
        "paths": {
          "@functionsFolder": ["functions/generateData"]
        }
      }
    }

Yarn start works perfect, but yarn build throw error "Attempted import error: 'generateDataForFile' is not exported from '@functionsFolder/"generateDataForFile'.

dawnmist commented 3 years ago

This will be an issue with your local project, as the import error has nothing to do with react-app-rewired.

Two things I can see as potentials to begin with:

I think the first issue of only mapping a single file path above is likely the cause for your issue, but I've listed both possibilities just in case. To be able to debug it any further, I'd need an example repository that demonstrates the issue to be able to look at.

timarney commented 2 years ago

Closing this given no recent activity.