跳到主要内容

videoRecorder 库开发环境

2024年01月12日
柏拉文
越努力,越幸运

一、认识


二、编译配置


2.1 rollup.config.js

import JSON from '@rollup/plugin-json';
import CommonJS from '@rollup/plugin-commonjs';
import { string as String} from 'rollup-plugin-string';
import { nodeResolve as NodeResolve } from '@rollup/plugin-node-resolve';

export default {
input: {
'device': 'device/device.js',
'recorder': 'recorder/recorder.js',
},
output: {
dir: 'dist',
format: 'es',
sourcemap: true,
entryFileNames: '[name].js'
},
plugins: [
JSON(),
String({
include: '**/*.html',
exclude: ['**/index.html']
}),
CommonJS(),
NodeResolve()
]
};

三、脚本配置


package.json 脚本配置如下:

"scripts": {
"start": "rollup -c -w"
}

四、效果测试


import tpl from "./tpl.html"

const container = document.querySelector("root");
container.innerHTML = tpl;