d1/sqlite支持
This commit is contained in:
+16
-1
@@ -35,7 +35,7 @@ const nextConfig = {
|
||||
],
|
||||
},
|
||||
|
||||
webpack(config) {
|
||||
webpack(config, { isServer }) {
|
||||
// Grab the existing rule that handles SVG imports
|
||||
const fileLoaderRule = config.module.rules.find((rule) =>
|
||||
rule.test?.test?.('.svg')
|
||||
@@ -71,6 +71,21 @@ const nextConfig = {
|
||||
crypto: false,
|
||||
};
|
||||
|
||||
// Exclude better-sqlite3 and D1 modules from client-side bundle
|
||||
if (!isServer) {
|
||||
config.externals = config.externals || [];
|
||||
config.externals.push({
|
||||
'better-sqlite3': 'commonjs better-sqlite3',
|
||||
});
|
||||
|
||||
config.resolve.alias = {
|
||||
...config.resolve.alias,
|
||||
'better-sqlite3': false,
|
||||
'@/lib/d1.db': false,
|
||||
'@/lib/d1-adapter': false,
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user