srod / node-minify

Light Node.js module that compress javascript, css and html files
https://node-minify.2clics.net
MIT License
509 stars 54 forks source link

CLI: "Named export 'globSync' not found" after switching to 9.0.0 #2510

Closed l-uuz closed 1 week ago

l-uuz commented 1 week ago

Steps to reproduce

Using the CLI tool in version 9.0.0 (first line to demonstrate a simple setup):

docker run --name node:18 -it bash
npm install -g @node-minify/cli @node-minify/uglify-js @node-minify/clean-css
node-minify --compressor clean-css --input "css/*.css" --output 'minified/$1.css'

Error

file:///usr/local/lib/node_modules/@node-minify/cli/node_modules/@node-minify/core/dist/index.mjs:82
import { globSync } from "fast-glob";
         ^^^^^^^^
SyntaxError: Named export 'globSync' not found. The requested module 'fast-glob' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'fast-glob';
const { globSync } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:191:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:106:12)

Node.js v18.20.4

The following works

npm install -g @node-minify/cli@8 @node-minify/uglify-js@8 @node-minify/clean-css@8
node-minify --compressor clean-css --input "css/*.css" --output 'minified/$1.css'
srod commented 1 week ago

Thanks, it should be fixed with version 9.0.2