
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
spfx-fast-serve
Advanced tools
Improve your SharePoint Framework development by speeding up 'serve' command
A command line utility, which modifies your SharePoint Framework solution, so that it runs continuous serve
command as fast as possible.
Compare "refresh" time (the time needed to compile your project when you change a file and start refreshing a page in a browser):
NOTE: The actual time depends on the environment, hardware, but at least you can see the difference
gulp serve | spfx-fast-serve | |
---|---|---|
Default "Hello World" React web part | 3-5 sec | 0.3-0.5 sec |
PnP Modern Search solution | 28-34 sec | 2-4 sec |
SP Starter Kit solution (v1) | 40-50 sec | 2-3 sec |
Read more info in my blog post here.
npm install spfx-fast-serve -g
spfx-fast-serve
and follow instructions. In most cases you shouldn't do anything specific and the cli "just works".npm install
npm run serve
and enjoy the incredible speed of serve
command!SharePoint Online and SharePoint 2019, which basically means SharePoint Framework 1.4.1 and above.
SharePoint 2016 is NOT supported.
The tool adds necessary files to run your own webpack based build with webpack dev server. Technically it's a custom webpack build, which produces the same output files as SharePoint Framework build pipeline, but does it a lot faster, because of a number of improvements:
Also
gulp serve
node_modules
folderWith spfx-fast-serve
you will be able to significantly reduce the time from code change to a page refresh in a browser (a few times faster than the default gulp serve
command).
Please use this guide to configure spfx-fast-serve
with library components.
If you want to use sp-rest-proxy
, simply run
spfx-fast-serve --rest-proxy
It will add sp-rest-proxy
support. You can find an example with PnPjs and built-in SPHttpClient
under samples/sp-rest-proxy
NOTE: to make it work, you should have config/private.json
credential file available with your credentials for SharePoint site. Alternatively, you can modify generated webpack.js
and provide path or credentials explicitly.
pnpm
resolves modules a bit differently, when it comes to nested modules. Thus if you use pnpm
as your package manager, add --pnpm
parameter when running spfx-fast-serve
As part of the steps, spfx-fast-serve
modifies your gulpfile.js
. In most cases it smoothly merges all required stuff. However, in case if you use build.configureWebpack.mergeConfig
in your code, the tool is unable to perform merge correctly. In that case you should do manual merge.
Simply locate you code with build.configureWebpack.mergeConfig
and insert the line
fs.writeFileSync("./temp/_webpack_config.json", JSON.stringify(generatedConfiguration, null, 2));
at the beginning of your additionalConfiguration
callback method.
For example:
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
fs.writeFileSync("./temp/_webpack_config.json", JSON.stringify(generatedConfiguration, null, 2)); // <-- the needed line
// your stuff goes here
return generatedConfiguration;
}
});
Additionally at the top of your gulpfile.js
add fs
tool import: const fs = require("fs");
.
That's it!
Please use issues for questions, suggestions and, of course, issues.
[1.11.0] - 13 Dec 2020
FAQs
Improve your SharePoint Framework development by speeding up 'serve' command
The npm package spfx-fast-serve receives a total of 389 weekly downloads. As such, spfx-fast-serve popularity was classified as not popular.
We found that spfx-fast-serve demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.