我已经创建了一个Web组件,用于在任何html内容中显示RASE。
我使用Lit Element typescript Starter Project作为基线,它附带了rollup.config.js
文件。
我将输出格式更改为iife
,其余格式保持不变,但组件和包名称除外。我这样做的原因是,我希望可以通过脚本标记轻松地访问包,而ROLLUP说iife
格式可以做到这一点。
This is the modified rollup.config.js
file。
// ============================================
// The configuration is based on the rollup starter
// app found here:
//
// https://github.com/rollup/rollup-starter-app/blob/master/package.json
//
// This project is based
// ============================================
/**
* @license
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import {terser} from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import filesize from 'rollup-plugin-filesize';
// `npm run build` -> `production` is true
// `npm run dev` -> `production` is false
const production = !process.env.ROLLUP_WATCH;
export default {
input: 'fs-gist.js',
output: {
file: 'fs-gist.bundle.js',
format: 'iife', // immediately-invoked function expression — suitable for