1 Star 0 Fork 2

shwull/cms_web_component

forked from jplusztx/cms_web_component 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.dev.js 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
jplusztx 提交于 2023-02-07 15:14 . cms-rate-v2 createElement改造版
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
import rollupPluginInjectProcessEnv from 'rollup-plugin-inject-process-env';
import fs from 'fs';
const htmlTmp = async ({ files }) => {
const jsFile = files.js.find(file => {
const reg = /index.*?.js$/;
return reg.test(file.fileName);
});
const res = await new Promise((resolve, reject) => {
fs.readFile('public/template.html', { encoding: 'utf-8' }, (err, res) => {
if (err) {
return reject(err);
}
resolve(res);
});
});
const finallyFilePath = res.replace(/{{.+}}/, jsFile.fileName);
return finallyFilePath;
};
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'esm',
sourcemap: true,
},
plugins: [
livereload({ watch: ['dist', 'public'] }),
serve({
open: true,
port: 8000,
openPage: '/template.html',
contentBase: ['public', 'dist'],
}),
commonjs(),
rollupPluginInjectProcessEnv({
NODE_ENV: 'production', //'development',
}),
nodeResolve(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'runtime',
}),
],
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/shwull/cms_web_component.git
git@gitee.com:shwull/cms_web_component.git
shwull
cms_web_component
cms_web_component
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385