Skip to content

Fix webpack build failure with gas-webpack-plugin #29

Description

@Yuto-24

Summary

npm run build fails during the webpack step after rimraf dist succeeds.

This was found while validating the js-yaml security advisory fix on branch fix/dependabot-js-yaml. The js-yaml fix itself is separate: npm ls js-yaml resolves to js-yaml@4.2.0, and npm test passes. This issue tracks the remaining webpack build failure as a separate follow-up.

Reproduction

npm run build

The build script is:

npm run lint && npm run test && rimraf dist && webpack && cpx src/appsscript.json dist && cpx "src/**/*.html" dist

Observed result

lint and test pass, then webpack fails:

(node:2540642) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
/home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:5043
                        if (buildInfo.assets) {
                                      ^

TypeError: Cannot read properties of undefined (reading 'assets')
    at Compilation.createModuleAssets (/home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:5043:18)
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3484:13
    at Compilation._runCodeGenerationJobs (/home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3639:11)
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3466:12
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3733:6
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/neo-async/async.js:2818:7
    at done (/home/yuto/github/Yuto-24/SlackLog/node_modules/neo-async/async.js:3522:9)
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3694:8
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Compilation.js:3813:5
    at /home/yuto/github/Yuto-24/SlackLog/node_modules/webpack/lib/Cache.js:98:34

Node.js v25.9.0

Current webpack-related setup

  • webpack: 5.106.1
  • webpack-cli: 4.10.0
  • gas-webpack-plugin: 1.2.3
  • webpack.config.js uses new GasPlugin()

Notes

Because the script removes dist/ before invoking webpack, a failed build leaves dist/appsscript.json and dist/slackLog.js as deleted files in the working tree. Those deleted dist/ changes should not be committed as part of unrelated dependency/security fixes.

Expected result

npm run build should complete successfully and regenerate dist/ artifacts.

Possible direction

Investigate compatibility between gas-webpack-plugin@1.2.3 and webpack 5. Options may include:

  • updating or replacing gas-webpack-plugin
  • adjusting the webpack plugin usage/configuration
  • pinning webpack to a compatible version if the project expects the old plugin behavior

Keep this separate from the js-yaml security advisory fix so dependency security remediation and build pipeline repair remain reviewable independently.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions