Convert from CommonJS to ESM#362
Merged
Merged
Conversation
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Convert CommonJS modules to ESM importing
Convert from CommonJS to ESM
Jan 30, 2026
Owner
|
@copilot CI failed, please fix |
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
Contributor
Author
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.
Convert from CommonJS to ESM
"type": "module"to package.json to enable ESMrequire()statements toimportstatements in main.jsconst core = require('@actions/core')toimport core from '@actions/core'const exec = require('@actions/exec')toimport exec from '@actions/exec'const github = require('@actions/github')toimport github from '@actions/github'const artifact = require('@actions/artifact')toimport artifact from '@actions/artifact'const AdmZip = require('adm-zip')toimport AdmZip from 'adm-zip'const filesize = require('filesize')toimport { filesize } from 'filesize'(named export)const pathname = require('path')toimport pathname from 'node:path'(with node: prefix)const fs = require('fs')toimport fs from 'node:fs'(with node: prefix)node:protocol prefix for built-in modules (best practice for ESM)filtered- addedconstdeclaration (ESM strict mode requirement)filesize.filesize()tofilesize()(named import)node --check main.js💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.