🐛 [BUG] Error when used with Next.js
- Dominant language
- TypeScript
- Stars
- 87
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
### 🐛 Bug description [Please make everyone to understand it]
> Please provide a link by forking these links [LarkMap](https://codesandbox.io/s/larkmap-issue-template-c9m1hr) or GitHub repo, a minimal reproduction.
```js
"use client"
import type { LarkMapProps } from '@antv/larkmap';
import { LarkMap } from '@antv/larkmap';
import React from 'react';
const config: LarkMapProps = {
mapType: 'Gaode',
mapOptions: {
style: 'light',
center: [120.210792, 30.246026],
zoom: 9,
// token: '你申请的 Key',
},
};
export default function L7Map() {
return (
LarkMap
)
}
```
### 📷 Step to reproduce
next.config.js
```js
const webpack = require('webpack');
const withLess = require('next-with-less');
const nextConfig = {
reactStrictMode: true,
webpack: config => {
config.plugins.push(
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('cesium'),
}),
);
return config;
},
// experimental: true
experimental : {
esmExternals: 'loose',
}
}
module.exports = withLess(nextConfig)
```
#### Error message reported by Next.js
```
- error ./node_modules/@antv/larkmap/es/components/ContextMenu/index.less
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules\@antv\larkmap\es\components\ContextMenu\index.js
```
### 🏞 Expected result
### 🚑 Any additional [like screenshots]
- **LarkMap Version**: latest
- **Platform**: windows and linux
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the LarkMap component and the supplied next.config.js, then start from the reported import in node_modules/@antv/larkmap/es/components/ContextMenu/index.js and its index.less file. Done means the minimal Next.js app builds without the Global CSS error and renders the map; no test file is mentioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, react, typescript, webpack
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100