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

Make loader paths extensible via .env file #1346

Closed
christiantinauer opened this issue Jan 4, 2017 · 1 comment
Closed

Make loader paths extensible via .env file #1346

christiantinauer opened this issue Jan 4, 2017 · 1 comment

Comments

@christiantinauer
Copy link

christiantinauer commented Jan 4, 2017

Hi,

first of all thank you for this app. It makes developing react apps a lot easier. What I now want to achieve is separating some controls/modules from my app and keep them in a different folder (outside of src). The problem is that css and babel loader ignore all files outside of src (and symlinks are resolved).

The idea is to make the loader paths extensible via the .env file (quite similar to NODE_PATH variable)

ADDITIONAL_APP_SOURCES=..\controls-app1\src;..\controls-app2\src

and adapt path.js

var appSrcs = (process.env.ADDITIONAL_APP_SOURCES || '')
  .split(process.platform === 'win32' ? ';' : ':')
  .filter(Boolean)
  .filter(folder => !path.isAbsolute(folder))
  .concat(['src'])
  .map(resolveApp);

...

module.exports = {
  appBuild: resolveApp('build'),
  appPublic: resolveApp('public'),
  appHtml: resolveApp('public/index.html'),
  appIndexJs: resolveApp('src/index.js'),
  appPackageJson: resolveApp('package.json'),
  appSrc: appSrcs,
  yarnLockFile: resolveApp('yarn.lock'),
  testsSetup: resolveApp('src/setupTests.js'),
  appNodeModules: resolveApp('node_modules'),
  // this is empty with npm3 but node resolution searches higher anyway:
  ownNodeModules: resolveOwn('../node_modules'),
  nodePaths: nodePaths
};

Is this a good idea? Am I missing something?

With kind regards,

Christian

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Hi, thanks for the suggestion. There's been numerous discussions around this so please subscribe to these issues if you're interested: #741, #1065, #1492, #1333. Cheers!

@gaearon gaearon closed this as completed Feb 11, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants