webpack-contrib / postcss-loader

PostCSS loader for webpack
MIT License
2.86k stars 209 forks source link

parse ESM with javascript #663

Closed luojunbang closed 11 months ago

luojunbang commented 1 year ago

Bug report

parse ESM with Javascript

Actual Behavior

using .mts , it can interopDefault, but using .mjs ,it can not be export default

the config can not be function

./utils.js
function loadConfig(){
/** ... */
try {
        importESM = new Function("id", "return import(id);"); // it should parse default?
      } catch (e) {
        importESM = null;
      }

Expected Behavior

How Do We Reproduce?

Please paste the results of npx webpack info here, and mention other relevant information

alexander-akait commented 11 months ago

Sorry I don't undestand you, feel free to rewrite the problem and I will reopen