pnp / docker-spfx

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

Different Content of WebpackConfigurationGenerator.js in v1.12.1 and Newer #63

Closed shurick81 closed 2 years ago

shurick81 commented 2 years ago

There seems to be not enough flexibility in the WebpackConfigurationGenerator.js adjustments description in https://github.com/waldekmastykarz/docker-spfx#cant-access-bundles-in-sharepoint-framework-1121. Original contents of the file is different for different SPFx versions:

1.12.1

string 376

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://${serveConfig.hostname || 'localhost'}:${serveConfig.port || 4321}/dist/`;

1.13.1

string 393

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://${serveConfig.hostname || 'localhost'}:${serveConfig.port || 4321}/${distFolderName}/`;

A test for the future versions:

docker run --rm waldekm/spfx:1.12.1 bash -c "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; sed -n 376p /usr/app/spfx/helloworld/node_modules/@microsoft/spfx-heft-plugins/lib/plugins/webpackConfigurationPlugin/WebpackConfigurationGenerator.js"
waldekmastykarz commented 2 years ago

Good catch! Do you mean we should have a similar list of versions and the affected lines like we have for the other modification that you've added?

shurick81 commented 2 years ago

Yes, I think so, something like this maybe?

Can't access bundles in SharePoint Framework 1.13.1

Modify node_modules\@microsoft\spfx-heft-plugins\lib\plugins\webpackConfigurationPlugin\WebpackConfigurationGenerator.js:393

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://${serveConfig.hostname || 'localhost'}:${serveConfig.port || 4321}/${distFolderName}/`;

to:

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://localhost:${serveConfig.port || 4321}/${distFolderName}/`;

Can't access bundles in SharePoint Framework 1.12.1

Modify node_modules\@microsoft\spfx-heft-plugins\lib\plugins\webpackConfigurationPlugin\WebpackConfigurationGenerator.js:393

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://${serveConfig.hostname || 'localhost'}:${serveConfig.port || 4321}/dist/`;

to:

const debugBaseUrl = `${serveConfig.https ? 'https' : 'http'}://localhost:${serveConfig.port || 4321}/dist/`;
waldekmastykarz commented 2 years ago

Looks good! Could you please create a PR? Thank you once again! 👏

shurick81 commented 2 years ago

No problemo: https://github.com/waldekmastykarz/docker-spfx/pull/64

shurick81 commented 2 years ago

A new one: https://github.com/waldekmastykarz/docker-spfx/pull/67

shurick81 commented 2 years ago

Should I update the fork with new updates (renaming the image name in Docker hub) @waldekmastykarz?

waldekmastykarz commented 2 years ago

That's not needed. The PR is still active and I just didn't get a chance to process it yet. Will do asap