Is your feature request related to a problem? Please describe.
Attempting to use the mui.materials wrapper in a target.set("es2015") environment results in
example project here: #2841
jsBrowserDevelopmentRun runtime errors:
Uncaught runtime errors:
ERROR
Cannot find module '@mui/material/Box'
webpackMissingModule@webpack-internal:///./kotlin/react-mui-materials/example/react/View.mjs:5:50
@webpack-internal:///./kotlin/react-mui-materials/example/react/View.mjs:5:142
./kotlin/react-mui-materials/example/react/View.mjs@http://localhost:8080/index.js:1649:1
__webpack_require__@http://localhost:8080/index.js:1682:32
fn@http://localhost:8080/index.js:1888:21
@webpack-internal:///./kotlin/react-mui-materials/example/react/Main.mjs:7:86
./kotlin/react-mui-materials/example/react/Main.mjs@http://localhost:8080/index.js:1638:1
__webpack_require__@http://localhost:8080/index.js:1682:32
fn@http://localhost:8080/index.js:1888:21
./kotlin/react-mui-materials.mjs@http://localhost:8080/index.js:1619:120
__webpack_require__@http://localhost:8080/index.js:1682:32
@http://localhost:8080/index.js:2782:56
@http://localhost:8080/index.js:2785:12
webpackUniversalModuleDefinition@http://localhost:8080/index.js:17:33
@http://localhost:8080/index.js:18:3
In my production project with target.set("es2015") enabled
, I also see jsNodeTest build errors:
Exception during run: Error: Directory import '.../build/js/node_modules/@mui/material/Box' is not supported resolving ES modules imported from .../build/js/packages/app-test/kotlin/app.mjs
Did you mean to import "@mui/material/node/Box/index.js"?
at finalizeResolution (node:internal/modules/esm/resolve:262:11)
at moduleResolve (node:internal/modules/esm/resolve:864:10)
at defaultResolve (node:internal/modules/esm/resolve:990:11)
at ModuleLoader.#cachedDefaultResolve (node:internal/modules/esm/loader:755:20)
at ModuleLoader.resolve (node:internal/modules/esm/loader:732:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38)
at ModuleJob.#link (node:internal/modules/esm/module_job:208:49) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///.../build/js/node_modules/@mui/material/Box'
}
Describe the solution you'd like
App will compile and run without errors with target.set("es2015") enabled
Additional context
According to the LLM:
MUI v5.14+ ships a proper exports field in package.json that supports ESM subpath imports.
`build/js/node_modules/@mui/material/package.json` has no exports field at all.
Without exports, Node.js's ESM resolver has no subpath map to follow, so when Kotlin's generated .mjs tries to import @mui/material/Box, the ESM loader sees a directory with no guidance and throws ERR_UNSUPPORTED_DIR_IMPORT.
Is your feature request related to a problem? Please describe.
Attempting to use the mui.materials wrapper in a
target.set("es2015")environment results inexample project here: #2841
jsBrowserDevelopmentRun runtime errors:
In my production project with
target.set("es2015")enabled, I also see jsNodeTest build errors:
Describe the solution you'd like
App will compile and run without errors with
target.set("es2015")enabledAdditional context
According to the LLM: