Exporting static html files on Next.Js, the href and src directory on HTML is not going to the "_next" folder. If I set it manually by adding ../../ in the index.html, then it works fine. Same for JS files.
Any idea where to pre-configure this before it is exported.
Thanks!
P.s I have a webpack config.
const config = {
mode: isProd ? "production" : "development",
entry: {
index: "./src/index.tsx"
},
output: {
path: `${__dirname}/dist`,
publicPath: '/',
filename: "[name].js"
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
alias: resolveTsAliases(__dirname + "/tsconfig.json")
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "babel-loader",
exclude: /node_modules/
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.(jpg|png)$/,
use: {
loader: "url-loader",
options: {
limit: 25000
}
}
},
{
test: /\.svg$/,
use: "file-loader"
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: "src/index.html"
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
})
]
};
I found another stack overflow thread, but they also manually set their directory, but I need it to work due to a lot of files being exported.
Tried researching on documentations couldn't find the possibility of pre-configuring CSS/JS path for exported files.