next-remove-imports
next-remove-imports copied to clipboard
Usage with mjs configs
Hi all,
I'm running into difficulty with using next-remove-imports
in a project which uses next.config.mjs
instead of the standard next.config.js
, which is currently documented. Any guidance on how to proceed here?
My config currently looks like this:
// @ts-check
import removeImports from 'next-remove-imports'
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds.
*/
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env.mjs"));
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
/**
* If you have the "experimental: { appDir: true }" setting enabled, then you
* must comment the below `i18n` config out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: {
locales: ["en"],
defaultLocale: "en",
},
...removeImports(),
};
export default config;
I've described the problem in this issue, but the problem seems to be that the TypeScript signature of removeImports
doesn't allow me to provide my existing config, and merging the result of removeImports()
doesn't seem to have any effect.
@RobotSail
https://github.com/uiwjs/next-remove-imports/blob/0e23be8ea25012e3131217a285586583dbf5ff36/core/src/index.ts#L8
import removeImports from 'next-remove-imports'
const removeImportsFun = removeImports({
options: { },
})
export default removeImportsFun({
reactStrictMode: true,
i18n: {
locales: ["en"],
defaultLocale: "en",
},
})
https://github.com/uiwjs/next-remove-imports/blob/e90b3441c8d2d519271eb1be1cab5f999f92848b/example/esm/next.config.mjs#L1-L16
Thanks @jaywcjlove!
I'm using this package exatcly as described in readme, but unable to import scss at component level still
@ticmaidev https://github.com/uiwjs/next-remove-imports/tree/main/example
You can provide a reproducible example through codesandbox.io, and I'll help you take a look.