custom absolute path for npm build
See original GitHub issueIf I run npm build
the build files are getting generated in the home directory of the project. Is there any way I can specify custom directory to generate build outside the home directory of the project?
Use case : I want to maintain build files and the development code in different repositories so that it will be easy for me to push to my CDN
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to Use Absolute Path for npm run build - Stack Overflow
So for my ReactJs project, I am using absolute path for import, like this import {button} from /buttons. instead of relative path like...
Read more >require absolute path - npm search
Resolves a given package if it is installed locally, then tries to resolve it from global registry, using battle-tested [global-modules][] package.
Read more >Absolute imports with Create React App | by David Gilbertson
WebStorm assumes absolute paths are in node_modules (as per the Node.js rules), so we must tell it that we're being fancy and using...
Read more >Use Absolute Paths with React - Better Programming
It can be done using a Resolver — a library that helps in locating a module by its absolute path. In the Webpack...
Read more >Advanced Features: Absolute Imports and Module Path Aliases
These options allow you to configure module aliases, for example a common pattern is aliasing certain directories to use absolute paths.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is no such option but you can work around it. Change
build
in yourpackage.json
scripts
to perform an additional step, likereact-scripts build && cp -r build ../your-folder
. If you’re on Windows the command would look differently but the idea is the same. There are also ways to write it in a cross platform way if you remove spaces before and after ampersands and launch a Node script that copies files instead of a UNIX command. I hope this helps!how would you write
for Windows.
I tried with xcopy, but when I npm run build where
I get this error in the command line: