Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename postcss.config.js to postcss.config.cjs #128

Merged
merged 1 commit into from
May 10, 2023

Conversation

ahosker
Copy link
Contributor

@ahosker ahosker commented May 10, 2023

On Default Laravel Sail Install the original STUB causes an error this solves the issue.

Renaming postcss.config.js to postcss.config.cjs fixes it (as the error advises)

Apparently, because package.json uses the contains "type".

Fixes Error:

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /var/www/html): [Failed to load PostCSS config] Failed to load PostCSS config (searchPath: /var/www/html): [ReferenceError] module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/www/html/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/www/html/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///var/www/html/postcss.config.js:1:1
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
]

Node.js v18.16.0

On Default Laravel Sail Install the original STUB causes an error this solves the issue.

Renaming postcss.config.cjs to postcss.config.js as the error outlines fixes the issue.

Fixes Error:
````
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /var/www/html): [Failed to load PostCSS config] Failed to load PostCSS config (searchPath: /var/www/html): [ReferenceError] module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/www/html/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/www/html/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///var/www/html/postcss.config.js:1:1
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
]

Node.js v18.16.0
````
@danharrin danharrin merged commit f218165 into laravel-frontend-presets:master May 10, 2023
1 check passed
@danharrin
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants