|
1 | 1 | import { defineConfig } from 'vite'
|
2 |
| -import vue from '@vitejs/plugin-vue' |
3 |
| -import eslint from '@rollup/plugin-eslint'; |
4 |
| -import path from 'path' |
5 |
| - |
6 |
| - |
7 |
| -/** This function is used to determine the file-name of the production assets entry-points. |
8 |
| - * |
9 |
| - * By default, every asset except `index.html` is concatenated with a hash, which is useful for caching. |
10 |
| - * However, for the scrape script, we would like to have a constant path which we can reference when |
11 |
| - * generating the bookmarklet URL at build-time. |
12 |
| - * |
13 |
| - * @type {(chunkInfo: import('rollup').PreRenderedChunk) => string } |
14 |
| -**/ |
15 |
| -const entryFileNameNamingRule = (chunkInfo) => { |
16 |
| - if (chunkInfo.name === "course-scrape-prod") { |
17 |
| - return "course-scrape-prod.js" |
18 |
| - } |
19 |
| - return "[name].[hash].js" |
20 |
| -} |
21 | 2 |
|
| 3 | +import commonConfig from './vite-common.config.js' |
22 | 4 |
|
23 | 5 | // https://vitejs.dev/config/
|
24 | 6 | export default defineConfig({
|
25 |
| - plugins: [vue(), { ...eslint({ |
26 |
| - include: '**/*.+(vue|js|jsx|ts|tsx)' |
27 |
| - }), enforce: 'pre', apply: 'build'}], |
28 |
| - resolve: { |
29 |
| - alias: { |
30 |
| - '@': path.resolve(__dirname, '/src') |
31 |
| - } |
32 |
| - }, |
33 |
| - server: { |
34 |
| - port: 8080, |
35 |
| - strictPort: true, |
36 |
| - hmr: { |
37 |
| - protocol: "ws", host: "localhost", port:8080 |
38 |
| - } |
39 |
| - }, |
40 |
| - build: { |
41 |
| - rollupOptions: { |
42 |
| - input: { |
43 |
| - main: path.resolve(__dirname, 'index.html'), |
44 |
| - "course-scrape-prod": path.resolve(__dirname, 'src/huji-import/course-scrape-entry.js') |
45 |
| - }, |
46 |
| - output: { |
47 |
| - entryFileNames: entryFileNameNamingRule |
48 |
| - } |
49 |
| - } |
50 |
| - } |
| 7 | + ...commonConfig |
51 | 8 | })
|
0 commit comments