Repository navigation
fix(admin): restore webpack build on Shopware 6.6 - #480
Merged
Merged
Conversation
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Why is this change necessary?
Since 3.15.0, the webpack build of the FroshTools administration fails on Shopware 6.6 with 8 errors. Any build that compiles the plugin source is affected, for example
shopware-cli project admin-watchorbin/watch-administration.sh. There are two causes.src/Resources/app/administration/package.jsondeclares"type": "module". Webpack then treats every.jsfile as strict ESM and only accepts fully specified imports. fix: use fully specified imports in administration for strict ESM builds #471 fixed this for 3.14.1. Four imports added in Fix health indicator layout on Shopware 6.7.15 sidebar #465 and feat: add Apps section with shop reachability, store login and shop id reset #467 have no extension again ('../../acl/privileges'and'../override-if-exists'). The release zip is built with esbuild, which accepts these imports, so the error only appears in projects that build the plugin with webpack.processasprocess/browserthroughProvidePluginandresolve.fallback. Webpack resolves that request from the importing file.debugandkleurcome in throughmermaid, and both sit in the plugin's ownnode_modules. Noprocesspackage is installed there.kleur/index.mjsis strict ESM, soprocess/browserwould fail even ifprocesswere installed.2. What does this change do, exactly?
.jsto the relative imports infrosh-tools-health-status/index.js,frosh-tools-tab-apps/index.js,overrides/sw-admin-menu/index.jsandoverrides/sw-version/index.js.src/Resources/app/administration/build/webpack.config.cjs. It aliasesprocess/browser$to the administration's ownprocess/browser.js, resolved from the webpack working directory. An absolute path also satisfies fully specified ESM. The file uses.cjsbecause the package is"type": "module". Shopware'sBundleConfigGeneratorand shopware-cli both detectbuild/webpack.config.cjs. The Vite build on 6.7 ignores the file."type": "module"stays in place.3. Describe each step to reproduce the issue or behaviour.
shopware-cli project admin-watch. It installs the plugin's npm dependencies and compiles the plugin source.process/browsererrors, and two are the resultingCannot read properties of undefined (reading 'module')errors.# Plugin "FroshTools": Extends the webpack config successfullyand compiles without errors.Shopware 6.7 builds the administration with Vite and is not affected.
4. Please link to the relevant issues (if any).
Follow-up to #471 (#468). The extensionless imports came back in #465 and #467.