Skip to content

Instantly share code, notes, and snippets.

@DroopyTersen
Created February 15, 2019 15:32
Show Gist options
  • Save DroopyTersen/a8820b6ddc69e228713845e0cffaee95 to your computer and use it in GitHub Desktop.
Save DroopyTersen/a8820b6ddc69e228713845e0cffaee95 to your computer and use it in GitHub Desktop.
Prevent SPFx from marking React as an external so that React in included in your bundle
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
build.addSuppression("Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.");
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
generatedConfiguration.externals = generatedConfiguration.externals
.filter(name => !(["react", "react-dom"].includes(name)))
return generatedConfiguration;
}
});
build.initialize(gulp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment