spfx-fast-serve
Advanced tools
Comparing version 2.0.0 to 2.0.1
# Change Log | ||
## [2.0.1] - 05 May 2021 | ||
### Fixed | ||
- [a problem with localized resources inside library component](https://github.com/s-KaiNet/spfx-fast-serve/issues/21) | ||
## [2.0.0] - 30 Apr 2021 | ||
@@ -4,0 +10,0 @@ |
@@ -0,0 +0,0 @@ # SPFx 1.12 notes |
@@ -0,0 +0,0 @@ # How to upgrade to 2.x version from 1.x |
@@ -0,0 +0,0 @@ const path = require("path"); |
@@ -0,0 +0,0 @@ const path = require("path"); |
@@ -0,0 +0,0 @@ const path = require("path"); |
@@ -0,0 +0,0 @@ /* |
@@ -13,3 +13,4 @@ { | ||
"cross-env": "7.0.3", | ||
"webpack-merge": "5.7.3" | ||
"webpack-merge": "5.7.3", | ||
"copy-webpack-plugin": "6.4.0" | ||
} |
const path = require("path"); | ||
const fs = require("fs"); | ||
const webpack = require("webpack"); | ||
const CopyPlugin = require("copy-webpack-plugin"); | ||
const certificateManager = require("@rushstack/debug-certificate-manager"); | ||
@@ -265,7 +266,31 @@ const certificateStore = new certificateManager.CertificateStore(); | ||
pathRewrite: pathRewrite(localizedPathMap) | ||
}] | ||
}]; | ||
if (settings.cli.isLibraryComponent) { | ||
addCopyPlugin(localizedResources); | ||
} | ||
return baseConfig; | ||
} | ||
function addCopyPlugin(localizedResources) { | ||
const patterns = []; | ||
for (const resourceKey in localizedResources) { | ||
const resourcePath = localizedResources[resourceKey]; | ||
const from = resourcePath.replace(/^lib/gi, "src").replace("{locale}", "*"); | ||
patterns.push({ | ||
flatten: true, | ||
from, | ||
to: function (data) { | ||
const fileName = path.basename(data.absoluteFilename); | ||
return resourceKey + "_" + fileName; | ||
} | ||
}); | ||
} | ||
baseConfig.plugins.push(new CopyPlugin({ | ||
patterns | ||
})); | ||
} | ||
function extractLocalizedPaths(scriptResources, localizedPathMap, localizedResources) { | ||
@@ -272,0 +297,0 @@ const resourceKeys = Object.keys(localizedResources); |
{ | ||
"name": "spfx-fast-serve", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Sergei Sergeev (https://github.com/s-KaiNet)", | ||
@@ -5,0 +5,0 @@ "description": "Improve your SharePoint Framework development by speeding up 'serve' command", |
@@ -28,8 +28,11 @@ # :rocket: SPFx Fast Serve Tool | ||
> **IMPORTANT!** SharePoint Framework 1.12 and onwards is supported starting from `2.x` version of `spfx-fast-serve`. | ||
> **IMPORTANT!** | ||
> SharePoint Framework 1.12 and onwards is supported starting from `2.x` version of `spfx-fast-serve`. | ||
> | ||
> Minimal supported NodeJS version is 12. | ||
> Minimal supported NodeJS version for SPFx 1.12 and up is `12.x`. | ||
Please use [this guide](/docs/Upgrade%20to%202x.md) if you're planning to migrate your project to `spfx-fast-serve` 2.x. | ||
Please use [this guide](/docs/Upgrade%20to%202x.md) if you're planning to migrate your project to `spfx-fast-serve` 2.x. | ||
If your project is based on SPx 1.11 and you already use fast-serve `2.x` for your project and planning to migrate to SPFx 1.12, then after migration you should run `spfx-fast-serve` again, so that it adds the needed dependencies and updates `webpack.js`. `fast-serve 2.x` uses different webpack.js and newer dependencies for SPFx 1.12. | ||
## Webpack extensibility | ||
@@ -55,2 +58,22 @@ | ||
Here is a full configuration example: | ||
```json | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/s-KaiNet/spfx-fast-serve/master/schema/config.1.0.schema.json", | ||
"cli": { | ||
"isLibraryComponent": false, | ||
"usePnpm": false, | ||
"useRestProxy": false | ||
}, | ||
"serve": { | ||
"open": true, | ||
"openUrl": "https://<org>.sharepoint.com/sites/dev/_layouts/15/workbench.aspx", | ||
"fullScreenErrors": true, | ||
"loggingLevel": 'normal' | ||
} | ||
} | ||
``` | ||
## Which SharePoint Framework versions are supported | ||
@@ -128,4 +151,7 @@ | ||
Additionally at the top of your `gulpfile.js` add `fs` tool import: `const fs = require("fs");`. | ||
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! | ||
@@ -132,0 +158,0 @@ |
@@ -55,5 +55,4 @@ { | ||
"required": [ | ||
"cli", | ||
"serve" | ||
"cli" | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
569947
13843
158