```
feat(router): 引入路由系统并重构页面结构 - 为项目引入基于 hash 的前端路由系统,支持多页面切换与动态加载 - 将原有单一 bundle 拆分为多个入口打包(index.js 和 timestamp.js) - 修改 Rollup 配置以支持多输出文件及插件共享 - 更新 HTML 结构以适配路由容器和页面占位元素 - 调整 CSS 样式,移除旧的页面切换动画,交由路由控制 - 优化 domUtils 工具函数,并迁移部分样式处理逻辑 - 在 timestamp.js 中封装初始化函数以便路由调用 - todolist 页面模板新增,用于后续功能开发 ```
This commit is contained in:
+36
-27
@@ -5,32 +5,41 @@ import json from '@rollup/plugin-json';
|
||||
import livereload from 'rollup-plugin-livereload';
|
||||
import serve from 'rollup-plugin-serve';
|
||||
|
||||
export default defineConfig({
|
||||
input: 'sidepanel/js/index.js',
|
||||
output: {
|
||||
file: 'dist/bundle.js',
|
||||
format: 'iife',
|
||||
const basePlugins = [resolve(), commonjs(), json()];
|
||||
|
||||
const devPlugins = [
|
||||
livereload({
|
||||
watch: ['dist', 'sidepanel'],
|
||||
verbose: false,
|
||||
}),
|
||||
serve({
|
||||
open: true,
|
||||
port: 8082,
|
||||
contentBase: ['.', 'sidepanel'],
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
input: 'sidepanel/js/index.js',
|
||||
output: {
|
||||
file: 'dist/index.js',
|
||||
format: 'iife',
|
||||
name: 'MainPage',
|
||||
},
|
||||
plugins: [...basePlugins, ...devPlugins],
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
json(),
|
||||
livereload({
|
||||
watch: ['dist', 'sidepanel'],
|
||||
verbose: false,
|
||||
}),
|
||||
serve({
|
||||
open: true,
|
||||
port: 8082,
|
||||
contentBase: ['.', 'sidepanel'],
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
}),
|
||||
],
|
||||
watch: {
|
||||
include: ['sidepanel/**/*'],
|
||||
exclude: ['node_modules/**/*'],
|
||||
clearScreen: false,
|
||||
|
||||
{
|
||||
input: 'sidepanel/js/timestamp.js',
|
||||
output: {
|
||||
file: 'dist/timestamp.js',
|
||||
format: 'iife',
|
||||
name: 'TimestampPage',
|
||||
},
|
||||
plugins: [...basePlugins, ...devPlugins],
|
||||
},
|
||||
});
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user