mirror of
https://github.com/yugasun/qrcode-decoder.git
synced 2026-08-12 20:27:56 +08:00
feat: add aio.min build
This commit is contained in:
@@ -6,10 +6,12 @@ import commonjs from 'rollup-plugin-commonjs';
|
||||
import { uglify } from 'rollup-plugin-uglify';
|
||||
import common from './rollup';
|
||||
|
||||
const prod = process.env.NODE_ENV;
|
||||
|
||||
export default {
|
||||
input: 'src/index.js',
|
||||
output: {
|
||||
file: 'dist/index.aio.js',
|
||||
file: prod ? 'dist/index.aio.min.js' : 'dist/index.aio.js',
|
||||
format: 'umd',
|
||||
// 如果不同时使用 export 与 export default 可打开legacy
|
||||
// legacy: true,
|
||||
@@ -28,6 +30,7 @@ export default {
|
||||
runtimeHelpers: true,
|
||||
exclude: 'node_modules/**',
|
||||
}),
|
||||
prod &&
|
||||
uglify({
|
||||
compress: {
|
||||
drop_debugger: true,
|
||||
@@ -37,7 +40,9 @@ export default {
|
||||
comments: (node, comment) => {
|
||||
if (comment.type === 'comment2') {
|
||||
// multiline comment
|
||||
return /@preserve|@license|@cc_on/i.test(comment.value);
|
||||
return /@preserve|@license|@cc_on/i.test(
|
||||
comment.value,
|
||||
);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
<hr />
|
||||
<video id="video" autoplay></video>
|
||||
|
||||
<script src="./index.aio.js"></script>
|
||||
<script src="./index.aio.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function main() {
|
||||
var qr = new QrcodeDecoder();
|
||||
|
||||
+4
-4
@@ -7,8 +7,8 @@
|
||||
<body>
|
||||
<button id="decode">Decode!</button><br>
|
||||
<span id="result"></span><br>
|
||||
<!-- <img src="./assets/qrcode.png" alt="qr code" /> -->
|
||||
<script src="./index.aio.js"></script>
|
||||
<img src="./assets/qrcode.png" alt="qr code" />
|
||||
<script src="./index.aio.min.js"></script>
|
||||
<script type="module">
|
||||
function main() {
|
||||
var qr = new QrcodeDecoder();
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
btn.onclick = async () => {
|
||||
// you can also decode from image path
|
||||
const code = await qr.decodeFromImage('./assets/qrcode.png');
|
||||
// const code = qr.decodeFromImage(img);
|
||||
// const code = await qr.decodeFromImage('./assets/qrcode.png');
|
||||
const code = await qr.decodeFromImage(img);
|
||||
console.log(code);
|
||||
result.innerText = code.data;
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
Vendored
+7
File diff suppressed because one or more lines are too long
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
<video src="./assets/qrcode-video.mp4"></video>
|
||||
|
||||
<script src="./index.aio.js"></script>
|
||||
<script src="./index.aio.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function main() {
|
||||
var video = document.querySelector('video');
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "qrcode-decoder",
|
||||
"version": "1.1.0",
|
||||
"version": "0.1.0",
|
||||
"description": "Tool for decoding qrcode",
|
||||
"main": "dist/index.js",
|
||||
"jsnext:main": "dist/index.esm.js",
|
||||
@@ -12,8 +12,9 @@
|
||||
"build:self": "rollup -c config/rollup.config.js",
|
||||
"build:esm": "rollup -c config/rollup.config.esm.js",
|
||||
"build:aio": "rollup -c config/rollup.config.aio.js",
|
||||
"build": "npm run clean && npm run build:self && npm run build:esm && npm run build:aio && npm run copy-file",
|
||||
"copy-file": "cp dist/index.aio.js demo/",
|
||||
"build:aio.min": "NODE_ENV=production npm run build:aio",
|
||||
"build": "npm run clean && npm run build:self && npm run build:esm && npm run build:aio && npm run build:aio.min && npm run copy-file",
|
||||
"copy-file": "cp dist/index.aio.min.js demo/",
|
||||
"test": "npm run lint && npm run build",
|
||||
"zuul-test": "zuul --local 8080 --ui mocha-bdd -- test/test.js",
|
||||
"release": "git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags",
|
||||
|
||||
Reference in New Issue
Block a user