pnp/docker-spfx

Can't access bundles in SharePoint Framework >=1.12.0 on Windows

Closed this issue · 8 comments

Starting from the workaround that was suggested for fixing the mapping. node_modules\@microsoft\sp-build-web\lib\SPWebBuildRig.js does not contain the lines that were suggested to replace. Hence, we cannot access the bundles.

here's how it was tested in Windows:

  1. Run the following lines in PS:
md spfx112testwp02
cd spfx112testwp02
docker run -it --rm -v ${pwd}:/usr/app/spfx waldekm/spfx:1.12.0 yo @microsoft/sharepoint --solution-name helloworld --component-type webpart --component-name wello-world-webpart --component-description "HelloWorld web part" --is-domain-isolated --framework none --environment spo --skip-feature-deployment false
  1. Agree to provide telemetry
  2. After the project is created and modules installed, check node_modules\@microsoft\sp-build-web\lib\SPWebBuildRig.js file contents.

I tested this with waldekm/spfx:1.12.0, waldekm/spfx:1.12.1 and waldekm/spfx:1.13.0. Also tested that this is not an issue with waldekm/spfx:1.11.0 image.

@waldekmastykarz could you help me with troubleshooting this one? How you managed to localize the mapping problem for the previous SPFx versions, when you came up with a workaround? We could have a chat if you have time for this.

OK, I might have an updated solution. Could you please confirm that it works?

In node_modules\@microsoft\spfx-heft-plugins\lib\plugins\webpackConfigurationPlugin\WebpackConfigurationGenerator.js change line 393 to:

const debugBaseUrl = `https://localhost:4321/${distFolderName}/`;

In node_modules\@microsoft\sp-build-core-tasks\lib\spfxServe\SpfxServeTask.js change line 109 to:

return new url_1.URL(`https://localhost:4321/`);

This changes are on top of the changes in ./config/serve.json and ./config/write-manifests.json.

Hi, I tested these changes that you suggested above with waldekm/spfx:1.13.0 and I managed to add a web part to the SPO hosted workbench! I did not even have to add the debugBasePath property to the config\write-manifests.json.

Actually, it even worked with just serve.json and WebpackConfigurationGenerator.js for me in Windows. I'm not sure if modification of write-manifests.json and SpfxServeTask.js is required for other OSes. Here's a PR: #55

Thanks for checking!

You are welcome! I forgot to mention that I tested on waldekm/spfx:1.12.1 also, so everything looks good

Awesome! I appreciate your help 👏