Skip to content

馃悰 [BUG] Error when used with Next.js聽#233

Description

@Chen-Zhihui

馃悰 Bug description [Please make everyone to understand it]

Please provide a link by forking these links LarkMap or GitHub repo, a minimal reproduction.

"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 {...config} style={{ height: '300px' }}>
            <h2 style={{ position: 'absolute', left: '10px' }}>LarkMap</h2>
        </LarkMap>
    )
}

馃摲 Step to reproduce

next.config.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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions