Essentially, the toolkit takes a dependency on azure-pipelines-task-lib which takes an additional dependency on ShellJS. Our toolkit uses the esbuild JS Bundler to build the extension. This fails to bundle ShellJS because it uses dynamic require statements (problematic ShellJS code) instead of explicit require statements, which prevents bundlers from correctly analyzing the dependencies.
In short, require('./a') works but require('./' + 'a') doesn't.
Related Issue(s), If Filed
An issue and PR have been opened on the ShellJS repo to change these dynamic require statements to explicit, but there are no plans to accommodate this in ShellJS
Testing
Confirmed that tasks run locally (e.g. node ./package/Tasks/AWSCLI/AWSCLI.js) and on hosted agent
Checklist
[x] I have read the README document
[x] I have read the CONTRIBUTING document
[x] My code follows the code style of this project
[ ] I have added tests to cover my changes
[ ] A short description of the change has been added to the changelog using the script npm run newChange
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Marks ShellJS as external for ESBuild Bundling. This fixes the issue in #522
Description
This issue emerged with the bump of azure-pipelines-task-lib dependency in: https://github.com/aws/aws-toolkit-azure-devops/pull/473.
Problem summarized in the open issue on azure-pipelines-task-lib repo: Cannot use JS bundler because of shelljs dependency.
Essentially, the toolkit takes a dependency on azure-pipelines-task-lib which takes an additional dependency on ShellJS. Our toolkit uses the esbuild JS Bundler to build the extension. This fails to bundle ShellJS because it uses dynamic require statements (problematic ShellJS code) instead of explicit require statements, which prevents bundlers from correctly analyzing the dependencies.
Related Issue(s), If Filed
Testing
Confirmed that tasks run locally (e.g.
node ./package/Tasks/AWSCLI/AWSCLI.js
) and on hosted agentChecklist
npm run newChange
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.