We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
参考下这个:https://www.npmjs.com/package/next-plugin-antd-less,antd 的一个第三方插件,不过没有按需加载的实现,因为配置babel就行,但是arco,按照需求配置babel无效。
我使用 Next.js 12 无法成功实现 按需加载,不只是我配置的问题还是什么?始终显示:Cannot use import statement outside a module,查阅了好多资料
The text was updated successfully, but these errors were encountered:
结合 next-transpile-modules 这个插件可以实现.
yarn add next-transpile-modules
这是我的配置.
next.config.js
const withAntdLess = require('next-plugin-antd-less'); const withTM = require('next-transpile-modules')([ '@arco-design/web-react' ]); /** @type {import('next').NextConfig} */ const nextConfig = { lessLoaderOptions: { lessOptions: { modifyVars: { 'arcoblue-6': '#3abd8f' } } }, lessVarsFilePath: './src/styles/variables.less', // optional lessVarsFilePathAppendToEndOfContent: false, // optional // optional https://github.com/webpack-contrib/css-loader#object cssLoaderOptions: { mode: "local", localIdentName: "[hash:base64:8]", exportLocalsConvention: "camelCase", exportOnlyLocals: false } } module.exports = withAntdLess(withTM(nextConfig))
.babelrc.js
module.exports = { presets: [['next/babel']], plugins: [ [ 'import', { libraryName: '@arco-design/web-react', libraryDirectory: 'lib', camel2DashComponentName: false, style: true, // 样式按需加载 }, ] ], };
Sorry, something went wrong.
No branches or pull requests
Basic Info
What are the similar cases of this feature
参考下这个:https://www.npmjs.com/package/next-plugin-antd-less,antd 的一个第三方插件,不过没有按需加载的实现,因为配置babel就行,但是arco,按照需求配置babel无效。
What problem does this feature solve?
我使用 Next.js 12 无法成功实现 按需加载,不只是我配置的问题还是什么?始终显示:Cannot use import statement outside a module,查阅了好多资料
The text was updated successfully, but these errors were encountered: