当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript rollup-plugin-commonjs.default函数代码示例

本文整理汇总了TypeScript中rollup-plugin-commonjs.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

// @ts-ignore
const pkg = require("./package.json")

const LIBRARY_NAME = "reactotron-mst"
const GLOBALS = ["ramda", "mobx-state-tree", "mobx"]

export default {
  input: `build/es/${LIBRARY_NAME}.js`,
  external: GLOBALS,
  output: [
    {
      file: pkg.main,
      name: camelCase(LIBRARY_NAME),
      format: "umd",
      sourcemap: true,
      globals: GLOBALS,
    },
    {
      file: pkg.module,
      format: "es",
      sourcemap: true,
      globals: GLOBALS,
    },
  ],
  watch: {
    include: "build/es/**",
  },
  plugins: [commonjs(), resolve(), sourceMaps(), filesize()],
}
开发者ID:TheIdhem,项目名称:reactotron,代码行数:29,代码来源:rollup.config.ts

示例2: 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(),
    ]
};
开发者ID:KennethanCeyer,项目名称:Formula,代码行数:30,代码来源:rollup.config.ts

示例3: async

export default async (_: any, argv: any): Promise<Configuration> => {
    const IS_PRODUCTION = argv.mode === 'production';
    const CHANGELOG = await getMostRecentChangelogEntry();

    // Clean out dist directory
    await rimraf(path.join(__dirname, 'dist', '*'));

    await Promise.all([
        rollup({
            input: 'citeproc',
            plugins: [
                resolve(),
                commonjs(),
                IS_PRODUCTION &&
                    (await import('rollup-plugin-terser')).terser(),
            ],
        }),
    ]).then(([citeproc]) =>
        Promise.all([
            citeproc.write({
                file: 'dist/vendor/citeproc.js',
                format: 'iife',
                name: 'CSL',
            }),
        ]),
    );

    const plugins = new Set<Plugin>([
        new MiniCssExtractPlugin(),
        new CopyWebpackPlugin([
            {
                from: '**/*.{php,mo,pot}',
                ignore: ['academic-bloggers-toolkit.php'],
            },
            {
                from: '*.json',
                transform(content) {
                    return JSON.stringify(JSON.parse(content.toString()));
                },
            },
            {
                from: path.resolve(__dirname, 'LICENSE'),
            },
            {
                from: 'academic-bloggers-toolkit.php',
                transform(content) {
                    return content.toString().replace(/{{VERSION}}/g, VERSION);
                },
            },
            {
                from: 'readme.txt',
                transform(content) {
                    return content
                        .toString()
                        .replace(/{{VERSION}}/g, VERSION)
                        .replace(/{{CHANGELOG}}/g, CHANGELOG);
                },
            },
        ]),
        new CheckerPlugin(),
    ]);

    if (IS_PRODUCTION) {
        plugins.add(new ProgressPlugin());
    } else {
        plugins.add(
            new BrowserSyncPlugin({
                proxy: 'localhost:8080',
                open: false,
                reloadDebounce: 2000,
                port: 3005,
                notify: false,
            }),
        );
    }

    const TS_BASE_CONFIG = {
        silent: argv.json,
        useCache: !IS_PRODUCTION,
        cacheDirectory: path.resolve(
            __dirname,
            'node_modules/.cache/awesome-typescript-loader',
        ),
        reportFiles: ['**/*.{ts,tsx}', '!**/__tests__/**'],
    };

    return {
        devtool: IS_PRODUCTION ? 'source-map' : 'cheap-module-eval-source-map',
        watchOptions: {
            ignored: /(node_modules|__tests__)/,
        },
        context: path.resolve(__dirname, 'src'),
        externals: {
            '@wordpress/api-fetch': 'wp.apiFetch',
            '@wordpress/block-editor': 'wp.blockEditor',
            '@wordpress/blocks': 'wp.blocks',
            '@wordpress/components': 'wp.components',
            '@wordpress/compose': 'wp.compose',
            '@wordpress/data': 'wp.data',
            '@wordpress/dom-ready': 'wp.domReady',
//.........这里部分代码省略.........
开发者ID:dsifford,项目名称:academic-bloggers-toolkit,代码行数:101,代码来源:webpack.config.ts

示例4: SwRewriter

gulp.task('task:worker:basic:bundle', done => rollup
  .rollup({
    entry: 'tmp/esm/src/worker/builds/basic.js',
    plugins: [
      // TODO(alxhub): Switch to rxjs-es when export bug is fixed.
      new SwRewriter(),
      nodeResolve({jsnext: true, main: true}),
      commonjs({
        include: 'node_modules/**',
        namedExports: {
          'node_modules/jshashes/hashes.js': ['SHA1']
        }
      })
    ]
  })
  .then(bundle => bundle.write({
    format: 'iife',
    dest: 'tmp/es5/bundles/worker-basic.js',
  })));
开发者ID:mgechev,项目名称:mobile-toolkit,代码行数:19,代码来源:gulpfile.ts

示例5: nodeResolve

gulp.task('task:app:bundle', done => rollup
  .rollup({
    entry: 'tmp/esm/src/index.js',
    plugins: [
      nodeResolve({jsnext: true, main: true}),
      commonjs({
        include: 'node_modules/**',
      }),
    ],
    external: [
      '@angular/core',
    ]
  })
  .then(bundle => bundle.write({
    format: 'umd',
    moduleName: 'ng.appShell',
    dest: 'tmp/es5/bundles/app-shell.umd.js',
    globals: {
      '@angular/core': 'ng.core',
    },
  })));
开发者ID:madhu-amrit,项目名称:mobile-toolkit,代码行数:21,代码来源:gulpfile.ts

示例6:

import commonjs from 'rollup-plugin-commonjs';

// $ExpectType Plugin
commonjs();

// $ExpectType Plugin
commonjs({});

// $ExpectType Plugin
commonjs({
    include: 'node_modules/**',
    exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],
    extensions: [ '.js', '.coffee' ],
    ignoreGlobal: false,
    sourceMap: false,
    namedExports: { './module.js': ['foo', 'bar' ] },
    ignore: [ 'conditional-runtime-dependency' ],
});
开发者ID:Lavoaster,项目名称:DefinitelyTyped,代码行数:18,代码来源:rollup-plugin-commonjs-tests.ts

示例7: createRollupBundle

  /** Creates a rollup bundle of a specified JavaScript file.*/
  private async createRollupBundle(config: RollupBundleConfig) {
    const bundleOptions = {
      context: 'this',
      external: Object.keys(rollupExternals),
      input: config.entry,
      onwarn: (message: string) => {
        if (/but never used/.test(message)) {
          return false;
        }
        console.warn(message);
      },
      plugins: [
        rollupRemoveLicensesPlugin,
        rollupNodeResolutionPlugin(),
        rollupAlias(this.getResolvedSecondaryEntryPointImportPaths(config.dest))
      ]
    };

    const writeOptions = {
      name: config.moduleName || 'ng.web',
      amd: { id: config.importName },
      globals: rollupGlobals,
      file: config.dest,
      format: config.format,
      banner: buildConfig.licenseBanner,
      sourcemap: false
    };

    bundleOptions.plugins.push(commonjs({
      include: 'node_modules/**'
    }));

    // Only transpile es5 / umd packages
    if (!config.es6) {
      bundleOptions.plugins.push(babel({
        include: 'node_modules/**'
      }));
    }

    // For UMD bundles, we need to adjust the `external` bundle option in order to include
    // all necessary code in the bundle.
    if (config.format === 'umd') {
      // bundleOptions.plugins.push(minify());

      // For all UMD bundles, we want to exclude tslib from the `external` bundle option so that
      // it is inlined into the bundle.
      let external = Object.keys(rollupGlobals);
      external.splice(external.indexOf('tslib'), 1);

      // If each secondary entry-point is re-exported at the root, we want to exclude those
      // secondary entry-points from the rollup globals because we want the UMD for the
      // primary entry-point to include *all* of the sources for those entry-points.
      if (this.buildPackage.exportsSecondaryEntryPointsAtRoot &&
        config.moduleName === `ng.${this.buildPackage.name}`) {

        const importRegex = new RegExp(`@angular-mdc/${this.buildPackage.name}/.+`);
        external = external.filter(e => !importRegex.test(e));
      }

      bundleOptions.external = external;
    }

    return rollup.rollup(bundleOptions).then((bundle: any) => bundle.write(writeOptions));
  }
开发者ID:cd8608,项目名称:angular-mdc-web,代码行数:65,代码来源:build-bundles.ts

示例8: babel

    pkg.unpkg && { name: pkg.name, file: pkg.unpkg, format: 'umd' }
  ].filter(Boolean),
  plugins: [
    babel({
      configFile: path.join(__dirname, 'babel.config.js'),
      extensions: ['.ts', '.tsx', '.js']
    }),
    resolve({
      extensions: ['.ts', '.tsx', '.js']
    }),
    commonjs({
      namedExports: {
        '@storybook/addon-actions': [
          'action',
          'ADDON_ID',
          'PANEL_ID',
          'EVENT_ID'
        ],
        '@storybook/addons': ['makeDecorator'],
        react: [
          'createContext',
          'createElement',
          'Component',
          'Fragment',
          'forwardRef'
        ]
      }
    })
  ]
};
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:30,代码来源:rollup.config.ts

示例9: includePaths

  treeshake: true,
  plugins: [
    includePaths({
      include: {},
      paths: [join(Config.TMP_DIR, 'app')],
      external: [],
      extensions: ['.js', '.json', '.html', '.ts']
    }),
    nodeResolve({
      jsnext: true,
      main: true,
      module: true
    }),
    commonjs({
      //See project.config.ts to extend
      include: Config.ROLLUP_INCLUDE_DIR,
      namedExports: Config.getRollupNamedExports()
    })
  ]
};

export = (done: any) => {
  rollup
    .rollup(config)
    .then((bundle: any) =>
      bundle.generate({
        format: 'iife',
        sourcemap: Config.PRESERVE_SOURCE_MAPS
      })
    )
    .then((result: any) => {
开发者ID:albogdano,项目名称:angular2-para,代码行数:31,代码来源:build.bundles.app.rollup.aot.ts

示例10: require

const pluginBabel = require('rollup-plugin-babel')
const pluginNodeResolve = require('rollup-plugin-node-resolve')
const pluginCommonJS = require('rollup-plugin-commonjs')
const pluginImage = require('rollup-plugin-url')
const pluginMarkdown = require('rollup-plugin-md')
const pluginTypescript = require('rollup-plugin-typescript')
const pluginReplace = require('rollup-plugin-replace')
const path = require('path')

export const plugins = [
  pluginImage(),
  pluginMarkdown(),
  pluginNodeResolve(),
  pluginCommonJS(),
  pluginReplace({ 'process.env.NODE_ENV': '"production"' }),
  pluginTypescript({
    tsconfig: false,
    experimentalDecorators: true,
    module: 'es2015'
  }),
  pluginBabel({
    presets: [
      [
        require.resolve('@babel/preset-env'),
        {
          modules: false,
          targets: {
            browsers: ['last 2 versions']
          }
        }
      ]
开发者ID:liekkas,项目名称:rollup-plugin-vue,代码行数:31,代码来源:plugins.ts


注:本文中的rollup-plugin-commonjs.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。