هل يمكنك المساعدة في تحديد هذا الخطأ عندما أحاول التغيير من vite إلى laravel-mix
[webpack-cli] Error [ERR_REQUIRE_ESM]: require() of ES Module C:\laragon\www\myprojects\webpack.mix.js from C:\laragon\www\myprojects\node_modules\laravel-mix\setup\webpack.config.js not supported.
webpack.mix.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename webpack.mix.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in C:\laragon\www\myprojects\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at module.exports (C:\laragon\www\myprojects\node_modules\laravel-mix\setup\webpack.config.js:11:5)
at loadConfigByPath (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1439:37)
at async Promise.all (index 0)
at async WebpackCLI.loadConfig (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1454:35)
at async WebpackCLI.createCompiler (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1785:22)
at async WebpackCLI.runWebpack (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1890:20)
at async Command.<anonymous> (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:912:21)
at async Promise.all (index 1)
at async Command.<anonymous> (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1372:13) {
code: 'ERR_REQUIRE_ESM'
}
تم التعديل في بواسطة Mustafa Suleiman تعديل عنوان السؤال
السؤال
Ismail Zarrouki
هل يمكنك المساعدة في تحديد هذا الخطأ عندما أحاول التغيير من vite إلى laravel-mix
[webpack-cli] Error [ERR_REQUIRE_ESM]: require() of ES Module C:\laragon\www\myprojects\webpack.mix.js from C:\laragon\www\myprojects\node_modules\laravel-mix\setup\webpack.config.js not supported.
webpack.mix.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename webpack.mix.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in C:\laragon\www\myprojects\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at module.exports (C:\laragon\www\myprojects\node_modules\laravel-mix\setup\webpack.config.js:11:5)
تم التعديل في بواسطة Mustafa Suleimanat loadConfigByPath (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1439:37)
at async Promise.all (index 0)
at async WebpackCLI.loadConfig (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1454:35)
at async WebpackCLI.createCompiler (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1785:22)
at async WebpackCLI.runWebpack (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1890:20)
at async Command.<anonymous> (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:912:21)
at async Promise.all (index 1)
at async Command.<anonymous> (C:\laragon\www\myprojects\node_modules\webpack-cli\lib\webpack-cli.js:1372:13) {
code: 'ERR_REQUIRE_ESM'
}
تعديل عنوان السؤال
3 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.