Skip to content

Commit

Permalink
fix: successfully serve with the prod build, resolve #20
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson86tw committed Nov 19, 2021
1 parent 4b36617 commit 98746a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-dapp",
"version": "0.4.4",
"version": "0.4.5-beta.0",
"description": "Vue 3 library for building Dapps with ethers.js.",
"repository": "https://github.com/chnejohnson/vue-dapp",
"bugs": {
Expand Down Expand Up @@ -41,6 +41,7 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-inject": "^4.0.3",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-replace": "^2.4.1",
"@types/jest": "^26.0.20",
Expand Down
12 changes: 9 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import WindiCSS from 'vite-plugin-windicss'
import inject from '@rollup/plugin-inject'

export default defineConfig({
root: 'demo/',
plugins: [vue(), WindiCSS()],
resolve: {
alias: {
'vue-dapp': resolve(__dirname, './src/index.ts'),
process: require.resolve('process'),
buffer: require.resolve('buffer'),
util: require.resolve('util'),
},
},
build: {
rollupOptions: {
plugins: [inject({ Buffer: ['Buffer', 'Buffer'] })],
},
commonjsOptions: {
transformMixedEsModules: true,
},
},
})
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,15 @@
magic-string "^0.25.7"
resolve "^1.17.0"

"@rollup/plugin-inject@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-4.0.3.tgz#6f04ebc14790a8bf892286fe9b8c0eb1ddf4d5ce"
integrity sha512-lzMXmj0LZjd67MI+M8H9dk/oCxR0TYqYAdZ6ZOejWQLSUtud+FUPu4NCMAO8KyWWAalFo8ean7yFHCMvCNsCZw==
dependencies:
"@rollup/pluginutils" "^3.1.0"
estree-walker "^2.0.1"
magic-string "^0.25.7"

"@rollup/plugin-json@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
Expand Down

0 comments on commit 98746a7

Please sign in to comment.