unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not generate d.ts in nextjs

moliyu opened this issue · comments

here is my config

/** @type {import('next').NextConfig} */
const withLess = require('next-with-less')
const AutoImport = require('unplugin-auto-import/webpack')
const { resolve } = require('path')
// const nextConfig = {
//   reactStrictMode: true,
// }

module.exports = withLess({
  reactStrictMode: true,
  lessLoaderOptions: {
    lessOptions: {
      javascriptEnabled: true
    },
  },
  webpack: config => {
    config.plugins.push(AutoImport({
      imports: ['react'],
      // dts: resolve(__dirname, 'auto-imports.d.ts')
    }))
    return config
  }
})

We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.

@antfu @moliyu
Hi Antfu, moliyu.
I can confirm Moliyu's issue. I created new fresh latest Nextjs and add auto-import webpack plugin, serve alias for package classnames as default import and plugin not render d.ts file.

This is codesandbox.
https://codesandbox.io/s/nextjs-unplugin-auto-import-hg3sj?file=/next.config.js

Can you help review this case.

Thank!