forked from chromeos/chromeos.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
59 lines (58 loc) · 1.98 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* eslint-env node */
const { defineConfig } = require('vite');
const { eleventyPlugin } = require('vite-plugin-eleventy');
const { posthtmlPlugin } = require('vite-plugin-posthtml');
const { VitePWA: pwaPlugin } = require('vite-plugin-pwa');
const { posthtmlExternalLink } = require('posthtml-external-link');
const postHTMLChromeOSWord = require('./lib/transforms/chromeos-word');
const postHTMLLinkIcons = require('./lib/transforms/link-icons');
const postHTMLRemoveTrailingSlash = require('./lib/transforms/remove-trailing-slash');
const postHTMLGoogleStorageImages = require('./lib/transforms/google-storage-images');
const postHTMLMissingAttributes = require('./lib/transforms/missing-attributes');
const path = require('path');
module.exports = defineConfig({
root: 'site',
clearScreen: false,
server: {
open: true,
proxy: {
'/search': {
target: 'http://localhost:5010/cros-staging/us-central1',
changeOrigin: true,
},
},
},
resolve: {
alias: [
{
find: '$toolkit',
replacement: path.join(__dirname, './node_modules/sass-toolkit/stylesheets/toolkit'),
},
{
find: '$breakpoint',
replacement: path.join(__dirname, './node_modules/breakpoint-sass/stylesheets/breakpoint'),
},
],
},
build: {
outDir: '../public',
emptyOutDir: true,
},
plugins: [
eleventyPlugin(),
pwaPlugin({
injectRegister: false,
manifest: require('./site/manifest.json'),
srcDir: './',
filename: 'sw.js',
strategies: 'injectManifest',
injectManifest: {
globPatterns: ['**/*.css', '**/*.js', '_components/**/*.html', 'images/icons/**/*', 'en/index.html', 'index.html', '404.html', '**/404/index.html', 'offline/**/index.html'],
},
}),
// // imgPlugin(),
posthtmlPlugin({
plugins: [posthtmlExternalLink(), postHTMLChromeOSWord, postHTMLLinkIcons, postHTMLRemoveTrailingSlash, postHTMLGoogleStorageImages, postHTMLMissingAttributes],
}),
],
});