pnp / docker-spfx

Docker images for working with SharePoint Framework
https://hub.docker.com/r/m365pnp/spfx
MIT License
117 stars 49 forks source link

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

Closed shurick81 closed 3 years ago

shurick81 commented 3 years ago

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.
shurick81 commented 3 years ago

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.

shurick81 commented 3 years ago

@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.

waldekmastykarz commented 3 years ago

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.

shurick81 commented 3 years ago

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.

shurick81 commented 3 years ago

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: https://github.com/waldekmastykarz/docker-spfx/pull/55

waldekmastykarz commented 3 years ago

Thanks for checking!

shurick81 commented 3 years ago

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

waldekmastykarz commented 3 years ago

Awesome! I appreciate your help 👏