Tweaks for usage in another project #2
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.
Hi there!
I was trying to use this library in another project and ran into some problems:
@babel/runtimewas missing frombrython-runnerdependency list. So, when I usedimport BrythonRunner from 'brython-runner/lib/brython-runner.js', webpack complained that could not find the modules required by the code generated by the@babel/plugin-transform-runtimeplugin.lib/core/brython-runner.jsloadslib/core/brython-runner.worker.jsas a raw string, so calls likerequire("@babel/runtime/...")generated by@babel/plugin-transform-runtimeare not resolved by webpack. That results in the code failing to execute in the Web worker.In this pull request I address problem (1) by adding
@babel/runtimeas a dependency, as recommended by the documentation. This is done in the first commit.As for problem (2), instead of generating
lib/core/brython-runner.worker.jsin thecompile-js-babelGulp task, I change the build configuration so thatlib/core/brython-runner.worker.jsis generated as a bundle by webpack. This is done in the second commit.Finally, the third commit regenerates files in
lib/, which was done viayarn run build.I hope the changes proposed here do not break other workflows already in use! :-) If they do, what would be the way of using this library in another project using webpack?
Best regards,
Gustavo Sousa