postcss / autoprefixer

Parse CSS and add vendor prefixes to rules by Can I Use
https://twitter.com/autoprefixer
MIT License
21.58k stars 1.25k forks source link

Getting cannot use import statement outside a module while running autoprefixer script #1452

Closed abrarmadi closed 2 years ago

abrarmadi commented 2 years ago

I installed "autoprefixer" package and added this script

"prefix:css":"postcss --use autoprefixer -b 'last 10 versions' 
 style/stylesheet.comp.css -o style/style.prefix.css" 

to the package.json, but when I am trying to run it, I am getting the following error

SyntaxError: Cannot use import statement outside a module at Module._compile (internal/modules/cjs/loader.js:895:18) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) at Function.Module._load (internal/modules/cjs/loader.js:727:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) at internal/main/run_main_module.js:17:11

npm

ai commented 2 years ago

Sorry, I can't help with environment problems.

Autoprefixer uses CommonJS.

Check that postcss-cli was not moved to ESM.

abrarmadi commented 2 years ago

thank you for your answer.