pnp/docker-spfx

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

Closed this issue · 7 comments

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"

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?

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/`;

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

No problemo: #64

A new one: #67

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

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