Css fix error
Unanswered
Ocicat posted this in #help-forum
OcicatOP
import { ItemProvider, QuizProvider } from "../context/QuizContext";
import '../styles/globals.css'
export default function RootLayout({ children }) {
return (
<QuizProvider>
<ItemProvider>
<html lang="en">
<body>{children}</body>
</html>
</ItemProvider>
</QuizProvider>
);
} //// this is my layout.jsx code
////my package.jscon
{
"name": "next-layout",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
}
}
im getting this error ------>>
Build Error
Next.js (15.1.0)
Failed to compile
./src/styles/globals.css.webpack[javascript/auto]!=!../../node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!../../node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
D:\Coding\cooking\project\node_modules\next\dist\build\webpack\loaders\css-loader\src\index.js:1
import React from 'react';
^^^^^^
SyntaxError: Cannot use import statement outside a module
i had a simple nextjs setup and i want to use tailwind css and css both but when i import it from style/globals.css or from ./globals.css it gave me this error
import '../styles/globals.css'
export default function RootLayout({ children }) {
return (
<QuizProvider>
<ItemProvider>
<html lang="en">
<body>{children}</body>
</html>
</ItemProvider>
</QuizProvider>
);
} //// this is my layout.jsx code
////my package.jscon
{
"name": "next-layout",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
}
}
im getting this error ------>>
Build Error
Next.js (15.1.0)
Failed to compile
./src/styles/globals.css.webpack[javascript/auto]!=!../../node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!../../node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
D:\Coding\cooking\project\node_modules\next\dist\build\webpack\loaders\css-loader\src\index.js:1
import React from 'react';
^^^^^^
SyntaxError: Cannot use import statement outside a module
i had a simple nextjs setup and i want to use tailwind css and css both but when i import it from style/globals.css or from ./globals.css it gave me this error
13 Replies
can you share your css?
OcicatOP
@Alfonsus Ardani
i cant seem to figure this one out sorry
OcicatOP
No problem π
@Alfonsus Ardani
try removing type: module from package.json
OcicatOP
I tried this ...it doesn't work I think react 19 and next 15 is conflicting
no, that should not be relevant here. try creating a minimal reproduction repository
then i can clone and have a look
OcicatOP
Ok I'll share you the GitHub link ..wait for sometime
OcicatOP
@joulev can you please check it
I donβt open zip files from discord, sorry. Please upload to GitHub