mirror of
https://github.com/alexgo-io/stacks.js.git
synced 2026-04-28 17:25:51 +08:00
31 lines
687 B
JavaScript
31 lines
687 B
JavaScript
module.exports = function (api) {
|
|
|
|
// TODO: Should cache on api.caller and api.env for faster build times.
|
|
api.cache.invalidate(() => true);
|
|
|
|
const isTestEnv = api.env("test");
|
|
const isDevEnv = api.env("development");
|
|
|
|
// Babel config for web browser lib dist with wide-spread browser support.
|
|
let opts = {
|
|
presets: [
|
|
["@babel/preset-env", {
|
|
"targets": {
|
|
"esmodules": true
|
|
}
|
|
}]
|
|
],
|
|
plugins: [
|
|
"@babel/proposal-class-properties",
|
|
"@babel/proposal-object-rest-spread"
|
|
]
|
|
};
|
|
|
|
// Use full source maps in development env.
|
|
if (!opts.sourceMaps && isDevEnv) {
|
|
opts.sourceMaps = "both";
|
|
}
|
|
|
|
return opts;
|
|
}
|