I need to add the following external css and scripts in my NextJS app (NextJS version 13.4.13).
Style
https://company.com/statics/1/package/dist/1/styles/dls.min.css
Script
https://company.com/statics/1/package/dist/1/scripts/dls.min.js
How can I add it?
I tried the following.
File path: app-name/src/app/layout.js
import 'https://company.com/statics/1/package/dist/1/styles/dls.min.css'
import './globals.css'
import Script from "next/script";
export const metadata = {
title: 'title',
description: 'desc',
}
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<Script type="text/javascript" src="https://company.com/statics/1/package/dist/1/scripts/dls.min.js" />
</body>
</html>
)
}
But it throws error:
Failed to compile:
https://company.com/statics/1/package/dist/1/styles/dls.min.css Module build failed: UnhandledSchemeError: Reading from "https://company.com/statics/1/package/dist/1/styles/dls.min.css" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "https:" URIs. Import trace for requested module: https://company.com/statics/1/package/dist/1/styles/dls.min.css ./src/app/layout.js
<Head>tags from Next and then just use a standard<link>tag in there?