-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
113 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# vue2-libpag-webpack-demo | ||
|
||
> This template should help get you started developing with libpag and Vue 2 in Webpack. Use copy-webpack-plugin to make the project packaged by webpack can access libpag.wasm | ||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
npm install | ||
|
||
# serve with hot reload at localhost:8080 | ||
npm run serve | ||
|
||
# build for production with minification | ||
npm run build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict' | ||
const merge = require('webpack-merge') | ||
const prodEnv = require('./prod.env') | ||
|
||
module.exports = merge(prodEnv, { | ||
NODE_ENV: '"development"' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
|
||
module.exports = { | ||
dev: { | ||
// Paths | ||
assetsSubDirectory: 'static', | ||
assetsPublicPath: '/', | ||
proxyTable: {}, | ||
host: 'localhost', | ||
}, | ||
|
||
build: { | ||
// Template for index.html | ||
index: path.resolve(__dirname, '../dist/index.html'), | ||
|
||
// Paths | ||
assetsRoot: path.resolve(__dirname, '../dist'), | ||
assetsSubDirectory: 'static', | ||
assetsPublicPath: './', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use strict' | ||
module.exports = { | ||
NODE_ENV: '"production"' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const path = require('path') | ||
const config = require('./config') | ||
const CopyWebpackPlugin = require('copy-webpack-plugin') | ||
|
||
module.exports = { | ||
configureWebpack: { | ||
entry: { | ||
app: './src/main.js' | ||
}, | ||
output: { | ||
path: config.build.assetsRoot, | ||
filename: '[name].js', | ||
}, | ||
plugins: [ | ||
new CopyWebpackPlugin([ | ||
{ | ||
from: path.resolve(__dirname, './node_modules/libpag/lib/libpag.wasm'), | ||
to: config.build.assetsPublicPath, | ||
}, | ||
]), | ||
] | ||
}, | ||
publicPath: process.env.NODE_ENV === 'production' | ||
? config.build.assetsPublicPath | ||
: config.dev.assetsPublicPath, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Vue 3 + Vite + libpag | ||
|
||
This template should help get you started developing with libpag and Vue 3 in Vite. Use rollup-plugin-copy to make the project packaged by vite can access libpag.wasm | ||
|
||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
npm install | ||
|
||
# serve with hot reload at localhost:3000 | ||
npm run dev | ||
|
||
# build for production | ||
npm run build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
{ | ||
"name": "pag-vue", | ||
"name": "libpag-vue3-vite-demo", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"libpag": "^0.0.1", | ||
"@vitejs/plugin-vue": "^2.1.0", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"vue": "^3.2.25" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^2.0.0", | ||
"libpag": "^0.0.2", | ||
"vite": "^2.7.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue' | ||
|
||
import copy from 'rollup-plugin-copy' | ||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [vue()] | ||
}) | ||
plugins: [ | ||
vue(), | ||
copy({ | ||
targets: [ | ||
{ src: './node_modules/libpag/lib/libpag.wasm', dest: process.env.NODE_ENV === 'production' ? 'dist/' : './' }, | ||
], | ||
hook: process.env.NODE_ENV === 'production' ? 'writeBundle' : "buildStart", | ||
}), | ||
], | ||
base: './', | ||
}); |