Currently, I am facing a challenge in accessing a Promise which is essentially an array of file paths created within recursive.js. This script navigates through my directories and organizes my stylesheets. The main issue arises when trying to utilize this information in my webpack.config.js to compile all stylesheets in a specific order.
Despite my efforts, it seems like webpack.config.js is unable to retrieve the desired data from recursive.js, resulting in failure to generate the bundle of .css/.scss files!
I have tried various approaches to resolve this matter but none seem to be effective. Initially, I assumed that placing module.exports = { ... } inside .then( result => { ... } ) would suffice. However, it appears that module.exports attempts to utilize the result before it's fully prepared, ultimately leading to the generation of only main.js
The code snippet below illustrates the implementation within recursive.js:
[Insert provided recursive.js code here]
Within webpack.config.js, I have made some adjustments as well:
[Insert modified webpack.config.js code here]
It seems evident that using module.exports within webpack.config.js under .then((result) => { } ) might not be the correct approach.
Are there any alternative methods to tackle this issue?
Thank you for your assistance!
UPDATE
After exploring more insights to comprehend the guidance from FZs and Steve Holgado (Appreciate it!), I have refined my code structure as follows:
[Insert updated code snippet showcasing changes implemented]
Below are the commands utilized to execute the code effectively:
"scripts": {
"bundle-css-dev": "cross-env NODE_ENV=development webpack --config ./bundle-css.config.js --progress --colors",
"bundle-css-prod": "cross-env NODE_ENV=production webpack --config ./bundle-css.config.js --progress --colors"
}
To run a specific script, use: npm run bundle-css-dev -- --path="path_to_first_file_in_queue"