i'm getting the following error when i run "npm run dev" or "npm run prod":
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\postcss.config.js:1
export default {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1176:20)
at Module._compile (node:internal/modules/cjs/loader:1218:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at module.exports (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\import-fresh\index.js:32:59)
at loadJs (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\cosmiconfig\dist\loaders.js:16:18)
at Explorer.loadFileContent (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\cosmiconfig\dist\Explorer.js:84:32)
at processResult (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\webpack\lib\NormalModule.js:753:19)
at C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\webpack\lib\NormalModule.js:855:5
at C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\loader-runner\lib\LoaderRunner.js:399:11
at C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\loader-runner\lib\LoaderRunner.js:251:18
at context.callback (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at Object.loader (C:\Users\Danielk\Documents\Projects\Route Dispatch\RouteDispatch\node_modules\postcss-loader\dist\index.js:56:7)
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 2 errors
The error message suggests that there is a syntax error in the postcss.config.js file. Specifically, it is complaining about the "export default" statement. This suggests that the file is being treated as a CommonJS module instead of an ES module.
To fix this, you can try changing the file extension from .js to .cjs. This will tell Node.js to treat the file as a CommonJS module. Alternatively, you can try changing the "export default" statement to a CommonJS-style "module.exports" statement.
Example:
// postcss.config.cjs
module.exports = {
// your PostCSS configuration
};
Alternatively, you can try changing the "export default" statement to a CommonJS-style "module.exports" statement.
Example:
// postcss.config.js
module.exports = {
// your PostCSS configuration
};
@LaryAI
I had this problem.
Changing the first line of postcss.config.js from:
export default {
to
module.exports = {
solved the main and associated problems.
npm run dev now works again.
If this may help anyone. The application was built with no security has it was intended to be in the internal network, so i added breeze to manage access.