Last active
June 10, 2020 08:18
-
-
Save bryzettler/dde355176d1bd6f452d7c06a19668ba6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const build = () => { | |
const bundler = new Bundler(paths.appHtml, { | |
command: 'build', | |
outDir: paths.appBuild, | |
publicUrl: './', | |
cacheDir: './.parcelCache', | |
// Generate Source Maps for prod | |
sourceMaps: true, | |
}); | |
Promise.resolve(bundler.bundle()).then(() => { | |
copyPublicFolder(); | |
console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.'); | |
console.log('You may also serve it locally with a static server:') | |
console.log(); | |
}).catch((err) => { | |
printErrors('Failed to compile.', [err]); | |
process.exit(1); | |
}); | |
} | |
build(); |
Hey @p10petr, Its been a while since that medium article but the copyPublicFolder
was a fn in the build.js
file of create-react-app. This is the current implementation that they have, found here src.
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml,
});
}
Cheers! Much appreciated :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I just stumbled upon your code from your medium article. Mind if I ask for details of the copyPublicFolder() func? Is it just copying files in the paths.appBuild folder?