Use @wordpress/scripts for building and linting, and stop bundling React #65
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.
Description of the Change
This resolves #50 by installing @wordpress/scripts and using that package's scripts for building and linting. React is no longer included in the bundled JS. I was also able to remove some of the devDependencies that come with @wordpress/scripts, and I switched the ESLint and WebPack configs to use the configs provided.
I also ran the lint scripts from @wordpress/scripts and made all the suggested changes.
Alternate Designs
The CSS is bundled with the JS. It could be pulled out with MiniCssExtractPlugin, but I wasn't aware of a compelling reason to do so.
Benefits
The built script is smaller. Including @wordpress/scripts allows us to make use of the many tools that package provides.
Possible Drawbacks
Verification Process
Pull this branch to your local environment. Run
npm run install && npm run build
. React should not be included in the build. This can be hard to verify. I sometimes temporarily install the Webpack Bundle Analyzer plugin to double-check what's included.After rebuilding, the component should still work in the editor.
Checklist:
Changelog Entry
Integrate @wordpress/scripts for building and linting