42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import path from "node:path";
|
|
|
|
const appRoot = __dirname;
|
|
const cadJsSrc = path.join(appRoot, "src", "viewer-cadjs");
|
|
|
|
const nextConfig: NextConfig = {
|
|
allowedDevOrigins: ["127.0.0.1", "localhost"],
|
|
transpilePackages: ["cadjs", "three", "three-mesh-bvh"],
|
|
turbopack: {
|
|
resolveAlias: {
|
|
"@": "./src",
|
|
cadjs: "./src/viewer-cadjs",
|
|
three: "./node_modules/three",
|
|
"three/examples": "./node_modules/three/examples",
|
|
"three-mesh-bvh": "./node_modules/three-mesh-bvh",
|
|
gifenc: "./node_modules/gifenc/dist/gifenc.esm.js",
|
|
},
|
|
resolveExtensions: [".tsx", ".ts", ".jsx", ".js", ".mjs", ".json"],
|
|
},
|
|
webpack(config) {
|
|
config.resolve = config.resolve || {};
|
|
config.resolve.alias = {
|
|
...(config.resolve.alias || {}),
|
|
"@": path.join(appRoot, "src"),
|
|
cadjs: cadJsSrc,
|
|
three: path.join(appRoot, "node_modules", "three"),
|
|
"three/examples": path.join(appRoot, "node_modules", "three", "examples"),
|
|
"three-mesh-bvh": path.join(appRoot, "node_modules", "three-mesh-bvh"),
|
|
gifenc: path.join(appRoot, "node_modules", "gifenc", "dist", "gifenc.esm.js"),
|
|
};
|
|
config.resolve.extensions = [
|
|
...(config.resolve.extensions || []),
|
|
".js",
|
|
".mjs",
|
|
];
|
|
return config;
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|