modified js.Build to create a css file from js file with import #8419
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I opened an issue recently due to an error when calling js.Build on a .js file with a css import (e.g. "import ./a.css"). ESBuild has this feature and it requires an outDir to work correctly. In a recent commit to support external source maps, a temporary build directory was added as an output directory, but only when the external source map option was selected.
I propose that this temporary outDir should always be created and the result.OutputFiles[] should be iterated to see if it contains a css file. The code below works correctly and creates a file called ___.js.css.
This is the first time I am attempting to commit to an open source project and I am not a professional programmer. This code is not production ready but it should serve as a good starting point. I would love some help to implement this correctly, especially as I have never written Go code before. - [email protected]
Fixes #8411