import.meta.dirname
Unanswered
Siamese posted this in #help-forum
SiameseOP
Hey! I have a "npm" package with all my commonly used functions and I use import.meta.dirname.
This works fine with regular node.js but when I try to use it in my selfhosted (on node.js) next.js app, I get
Any ideas?
This works fine with regular node.js but when I try to use it in my selfhosted (on node.js) next.js app, I get
undefined
Any ideas?
3 Replies
SiameseOP
found some github issue with a workaround
/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (
config,
{ buildId, dev, isServer, defaultLoaders, nextRuntime, webpack },
) => {
config.plugins.push(
new webpack.DefinePlugin({
"import.meta.dirname": "__dirname",
}),
);
return config;
},
};
export default nextConfig;
Oh COME ON, it still works differently