Difinity是一个区块链容器。我需要一个关于如何部署一个标准的sveltekit应用程序的岩石坚实的例子。
他们的网页不包括sveltekit https://dfinity.org/svelte/
这是我的dfx.json文件:
{
"canisters": {
"assets": {
"dependencies": [],
"frontend": {
"entrypoint": "build/index.html"
},
"source": ["build"],
"type": "assets"
}
},
"defaults": {
"build": {
"output": "canisters",
"packtool": ""
}
},
"dfx": "0.9.3",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
},
"ic": {
"providers": ["https://mainnet.dfinity.network"],
"type": "persistent"
}
},
"version": 1
}命令npm run build将在./build中构建我的sveltekit应用程序的静态版本
发布于 2022-05-12 18:06:47
我们通过添加一些多填充来解决这个问题:
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
....
vite: {
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
global: true,
process: true,
url: true,
assert: true,
crypto: true,
http: true,
https: true,
os: true,
stream: true
})
]
}
},
...
}在svelte.config.js中
发布于 2022-05-12 15:38:50
部署期间的错误可能是由于dfx版本的问题造成的。使用较早版本的dfx创建的项目可能与较新版本的dfx不兼容。
https://stackoverflow.com/questions/71744659
复制相似问题