This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
hydrogen-web/vite.common-config.js

50 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

const cssvariables = require("postcss-css-variables");
const flexbugsFixes = require("postcss-flexbugs-fixes");
const fs = require("fs");
const path = require("path");
2021-12-17 20:43:26 +05:30
const manifest = require("./package.json");
const version = manifest.version;
const commonOptions = {
2021-12-22 20:55:09 +05:30
logLevel: "warn",
publicDir: false,
server: {
hmr: false
},
resolve: {
alias: {
// these should only be imported by the base-x package in any runtime code
// and works in the browser with a Uint8Array shim,
// rather than including a ton of polyfill code
"safe-buffer": "./scripts/package-overrides/safe-buffer/index.js",
"buffer": "./scripts/package-overrides/buffer/index.js",
}
},
build: {
emptyOutDir: true,
assetsInlineLimit: 0,
polyfillModulePreload: false,
},
define: {
DEFINE_VERSION: JSON.stringify(version),
DEFINE_GLOBAL_HASH: JSON.stringify(null),
},
css: {
postcss: {
plugins: [
cssvariables({
preserve: (declaration) => {
return declaration.value.indexOf("var(--ios-") == 0;
}
}),
// the grid option creates some source fragment that causes the vite warning reporter to crash because
// it wants to log a warning on a line that does not exist in the source fragment.
// autoprefixer({overrideBrowserslist: ["IE 11"], grid: "no-autoplace"}),
flexbugsFixes()
]
}
}
};
module.exports = commonOptions;