Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spfx-fast-serve

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spfx-fast-serve - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

lib/templates/1.11/gulpfile.js

6

CHANGELOG.md
# Change Log
## [2.0.4] - 08 May 2021
### Features
- "manual merge" was removed in favor of a better solution
## [2.0.3] - 06 May 2021

@@ -4,0 +10,0 @@

20

lib/commands/PatchGulpFile.js

@@ -42,14 +42,3 @@ "use strict";

}
let hasErrors = false;
let replaceContent;
if (currentGulpFile.indexOf('build.configureWebpack.mergeConfig') !== -1) {
replaceContent = fs.readFileSync(utils_1.getTemplatesPath('gulpfile.partial.js')).toString();
Logger_1.logger.warning(chalk_1.default.redBright('You use webpack\'s task \'mergeConfig\' feature in your gulpfile.js. Manual merge required.'));
Logger_1.logger.log(chalk_1.default.redBright('Please read https://github.com/s-KaiNet/spfx-fast-serve#manual-merge-warning for details.'));
Logger_1.logger.newLine();
hasErrors = true;
}
else {
replaceContent = fs.readFileSync(utils_1.getTemplatesPath('gulpfile.full.js')).toString();
}
const replaceContent = fs.readFileSync(utils_1.getTemplatesPath('gulpfile.js')).toString();
const options = {

@@ -61,8 +50,3 @@ files: gulpfilePath,

replace_in_file_1.default.sync(options);
if (!hasErrors) {
Logger_1.logger.success(chalk_1.default.blueBright('Patched gulpfile.js.'));
}
else {
Logger_1.logger.warning(chalk_1.default.blueBright('Patched gulpfile.js with warnings.'));
}
Logger_1.logger.success(chalk_1.default.blueBright('Patched gulpfile.js.'));
Logger_1.logger.newLine();

@@ -69,0 +53,0 @@ }

@@ -0,0 +0,0 @@ const path = require("path");

{
"name": "spfx-fast-serve",
"version": "2.0.3",
"version": "2.0.4",
"author": "Sergei Sergeev (https://github.com/s-KaiNet)",

@@ -5,0 +5,0 @@ "description": "Improve your SharePoint Framework development by speeding up 'serve' command",

@@ -122,37 +122,1 @@ # :rocket: SPFx Fast Serve Tool

## Having troubles? Please try to find the answer under [FAQs](/docs/FAQ.md) or raise an issue
## Manual merge warning
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
```javascript
fs.writeFileSync("./temp/_webpack_config.json", JSON.stringify(generatedConfiguration, null, 2));
```
at the beginning of your `additionalConfiguration` callback method.
For example:
```javascript
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");`.
> **IMPORTANT!**
> If you have your `build.configureWebpack.mergeConfig` inside `if` statements (it might be a case for PnP SPFx generator), then just make sure that the `_webpack_config.json` file is created on a regular `gulp bundle` command, because that's the command which is called right before custom serve. In this case, don't put `fs.writeFileSync` inside `if` statements, instead just add a regular `mergeConfig` like in the example above outside of `if` statement.
That's it!
---
Please use [issues](https://github.com/s-KaiNet/spfx-fast-serve/issues) for questions, suggestions and, of course, issues.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc