本文整理汇总了TypeScript中rollup-plugin-json.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
import scss from 'rollup-plugin-scss';
const pkg = require('./package.json');
const libraryName = 'formulize';
export default {
input: `src/${libraryName}.ts`,
output: [
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true }
],
external: [],
watch: {
include: 'src/**',
},
plugins: [
scss({ output: `dist/${libraryName}.css` }),
json(),
typescript({
tsconfigOverride: {
compilerOptions: {
module: 'es2015'
}
},
useTsconfigDeclarationDir: true
}),
commonjs(),
resolve(),
sourceMaps(),
]
};
示例2: generateBackendJs
async function generateBackendJs(): Promise<void> {
for (const bin of [
"genieacs-cwmp",
"genieacs-ext",
"genieacs-nbi",
"genieacs-fs",
"genieacs-ui"
]) {
const inputFile = path.resolve(INPUT_DIR, `bin/${bin}`);
const outputFile = path.resolve(OUTPUT_DIR, `bin/${bin}`);
const bundle = await rollup({
input: inputFile,
external: externals,
acorn: {
allowHashBang: true
},
treeshake: {
propertyReadSideEffects: false,
pureExternalModules: true
},
plugins: [
rollupReplace({
delimiters: ["", ""],
"#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only": ""
}),
rollupJson({ preferConst: true }),
{
resolveId: (importee, importer) => {
if (importee.endsWith("/package.json")) {
const p = path.resolve(path.dirname(importer), importee);
if (p === path.resolve(INPUT_DIR, "package.json"))
return path.resolve(OUTPUT_DIR, "package.json");
}
return null;
}
},
typescript({
tsconfig: "./tsconfig.json",
include: [`bin/${bin}`, "lib/**/*.ts"]
}),
MODE === "production" ? terser() : null
]
});
await bundle.write({
format: "cjs",
preferConst: true,
banner: "#!/usr/bin/env node",
file: outputFile
});
// Mark as executable
const mode = fs.statSync(outputFile).mode;
fs.chmodSync(outputFile, mode | 73);
}
}
示例3: generateFrontendJs
async function generateFrontendJs(): Promise<void> {
const inputFile = path.resolve(INPUT_DIR, "ui/app.ts");
const outputFile = path.resolve(OUTPUT_DIR, "public/app.js");
const bundle = await rollup({
input: inputFile,
external: externals,
plugins: [
rollupJson({ preferConst: true }),
typescript({ tsconfig: "./tsconfig.json" })
],
inlineDynamicImports: true,
treeshake: {
propertyReadSideEffects: false,
pureExternalModules: true
},
onwarn: ((warning, warn) => {
// Ignore circular dependency warnings
if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
}) as WarningHandler
});
await bundle.write({
preferConst: true,
format: "esm",
file: outputFile
});
const webpackConf = {
mode: MODE,
entry: outputFile,
resolve: {
aliasFields: ["module"]
},
output: {
path: path.resolve(OUTPUT_DIR, "public"),
filename: "app.js"
}
};
const stats = await promisify(webpack)(webpackConf);
process.stdout.write(stats.toString({ colors: true }) + "\n");
}
示例4:
import json from 'rollup-plugin-json';
json(); // $ExpectType Plugin
示例5:
import json from 'rollup-plugin-json';
json(); // $ExpectType Plugin
json({preferConst: true, indent: ' '}); // $ExpectType Plugin