当前位置: 首页 > news >正文

免费建站网站号品牌推广计划书怎么写

免费建站网站号,品牌推广计划书怎么写,做网站go和python,如何生成一个网站Rollup 是一个用于 JavaScript 的模块打包工具,它将小的代码片段编译成更大、更复杂的代码,例如库或应用程序。它使用 JavaScript 的 ES6 版本中包含的新标准化代码模块格式,而不是以前的 CommonJS 和 AMD 等特殊解决方案。ES 模块允许你自由…

        Rollup 是一个用于 JavaScript 的模块打包工具,它将小的代码片段编译成更大、更复杂的代码,例如库或应用程序。它使用 JavaScript 的 ES6 版本中包含的新标准化代码模块格式,而不是以前的 CommonJS 和 AMD 等特殊解决方案。ES 模块允许你自由无缝地组合你最喜欢的库中最有用的个别函数。这在未来将在所有场景原生支持,但 Rollup 让你今天就可以开始这样做。

除屑优化(Tree-Shaking)

除了可以使用 ES 模块之外,Rollup 还可以静态分析你导入的代码,并将排除任何实际上没有使用的内容。这使你可以在现有的工具和模块的基础上构建,而不需要添加额外的依赖项或使项目的大小变得臃肿。

例如,使用 CommonJS 必须导入整个工具或库

// 使用 CommonJS 导入整个 utils 对象
const utils = require('./utils');
const query = 'Rollup';
// 使用 utils 对象的 ajax 方法。
utils.ajax(`https://api.example.com?search=${query}`).then(handleResponse);

使用 ES 模块,我们不需要导入整个 utils 对象,而只需导入我们需要的一个 ajax 函数:

// 使用 ES6 的 import 语句导入 ajax 函数。
import { ajax } from './utils';
const query = 'Rollup';
// 调用 ajax 函数
ajax(`https://api.example.com?search=${query}`).then(handleResponse);

一.安装

//全局安装

npm install rollup --global

//安装到本地

npm install rollup --save-dev

二.基本使用

1.基础要点:

配置需要一个入口文件并且设置代码输出格式

 格式选项:

2.快速上手

创建入口文件:

打包:

三.配置文件

随着我们添加更多选项,输入命令会变得有点麻烦。

为了避免重复输入,我们可以创建一个包含所有必要选项的配置文件。配置文件是用 JavaScript 编写的,比原始的 CLI 更加灵活。

在项目根目录中创建一个名为 rollup.config.mjs 的文件

export default {

    input: 'src/index.js',

    output: {

        file: 'bundle.js',

        format: 'iife'

    }

};

使用配置文件

rm bundle.js # so we can check the command works!

rollup -c //表明我们需要使用配置文件

可以使用等效的命令行选项覆盖配置文件中的任何选项:

rollup -c -o bundle-2.js

如果你想,你也可以选择指定不同于默认的 rollup.config.mjs 的配置文件:

rollup --config rollup.config.dev.mjs 

四.使用插件 

到目前为止,我们已经用入口文件和通过相对路径导入的模块打了一个简单的包。随着你需要打包更复杂的代码,通常需要更灵活的配置,例如导入使用 NPM 安装的模块、使用 Babel 编译代码、处理 JSON 文件等等。

插件是rollup的唯一扩展方式

插件列表:Rollup Awesome List

1.@rollup/plugin-json

@rollup/plugin-json:允许 Rollup 从 JSON 文件中导入数据。

npm install --save-dev @rollup/plugin-json

(我们使用 --save-dev 而不是 --save,因为我们的代码在运行时实际上不依赖于插件,只有在打包时才需要。)

2.@rollup/plugin-node-resolve

@rollup/plugin-node-resolve:抹平rollup根据本地路径加载模块,不像webpack根据模块名称导入的差异。(一个 Rollup 插件,它使用 Node 解析算法来定位模块,用于在node_modules

npm install @rollup/plugin-node-resolve --save-dev

例如引入lodash-es

 3.@rollup/plugin-commonjs

@rollup/plugin-commonjs:由于rollup设计只处理ES模块,对于CommonJS 模块默认是不支持的,我们需要利用插件处理。(一个 Rollup 插件,用于将 CommonJS 模块转换为 ES6,以便它们可以包含在 Rollup bundle 中。)

npm install @rollup/plugin-commonjs --save-dev

五.代码拆分

Rollup 将使用动态导入创建一个仅在需要时加载的单独块。为了让 Rollup 知道在哪里放置第二个块,我们不使用 --file 选项,而是使用 --dir 选项设置一个输出文件夹:

修改配置文件:

总结

rollup优点:

缺点:

应用程序:webpack 库/框架:rollup


文章转载自:
http://dinncophyllotaxic.tqpr.cn
http://dinncoaliphatic.tqpr.cn
http://dinncounderdetermine.tqpr.cn
http://dinncocataphract.tqpr.cn
http://dinncojesting.tqpr.cn
http://dinncomiseducation.tqpr.cn
http://dinncoperineuritis.tqpr.cn
http://dinncoundershrub.tqpr.cn
http://dinncoximenes.tqpr.cn
http://dinncotopograph.tqpr.cn
http://dinncotelesoftware.tqpr.cn
http://dinncodesirable.tqpr.cn
http://dinncointraperitoneal.tqpr.cn
http://dinncohandbound.tqpr.cn
http://dinncogpt.tqpr.cn
http://dinncohypotyposis.tqpr.cn
http://dinnconc.tqpr.cn
http://dinncounciform.tqpr.cn
http://dinncomagistral.tqpr.cn
http://dinncoimpersonalize.tqpr.cn
http://dinncowhiggish.tqpr.cn
http://dinncobackflow.tqpr.cn
http://dinncostrikebreaking.tqpr.cn
http://dinncodiscolor.tqpr.cn
http://dinncoreparatory.tqpr.cn
http://dinncoadministrant.tqpr.cn
http://dinncomedoc.tqpr.cn
http://dinncoclonus.tqpr.cn
http://dinncoecopornography.tqpr.cn
http://dinncoscutum.tqpr.cn
http://dinncounderripe.tqpr.cn
http://dinncoalliterate.tqpr.cn
http://dinncobailie.tqpr.cn
http://dinnconickeliferous.tqpr.cn
http://dinncosialoid.tqpr.cn
http://dinncocatecholaminergic.tqpr.cn
http://dinncooutercoat.tqpr.cn
http://dinncohavurah.tqpr.cn
http://dinncovocally.tqpr.cn
http://dinncokloof.tqpr.cn
http://dinncodetraction.tqpr.cn
http://dinncosovnarkhoz.tqpr.cn
http://dinncoswakara.tqpr.cn
http://dinncospiritualist.tqpr.cn
http://dinncoperimorph.tqpr.cn
http://dinncosoleus.tqpr.cn
http://dinncoupgather.tqpr.cn
http://dinncomilitaristic.tqpr.cn
http://dinncobegone.tqpr.cn
http://dinncovolitant.tqpr.cn
http://dinncovanaspati.tqpr.cn
http://dinncoingroup.tqpr.cn
http://dinncopatella.tqpr.cn
http://dinncochamiso.tqpr.cn
http://dinncoalgoid.tqpr.cn
http://dinncophagocytose.tqpr.cn
http://dinncocozy.tqpr.cn
http://dinncocryptogamic.tqpr.cn
http://dinncorelativize.tqpr.cn
http://dinncoreconfirm.tqpr.cn
http://dinncofructosan.tqpr.cn
http://dinncocompensative.tqpr.cn
http://dinncoadmetus.tqpr.cn
http://dinncoexercitorial.tqpr.cn
http://dinncosublimize.tqpr.cn
http://dinncopolycystic.tqpr.cn
http://dinncodefamatory.tqpr.cn
http://dinncovelaria.tqpr.cn
http://dinncopongid.tqpr.cn
http://dinncounsized.tqpr.cn
http://dinncolettercard.tqpr.cn
http://dinncocephalometry.tqpr.cn
http://dinncopartaker.tqpr.cn
http://dinncoparadox.tqpr.cn
http://dinncoscottice.tqpr.cn
http://dinncopitching.tqpr.cn
http://dinncores.tqpr.cn
http://dinncofalasha.tqpr.cn
http://dinncodetractor.tqpr.cn
http://dinncotig.tqpr.cn
http://dinncoinflicter.tqpr.cn
http://dinncoemerson.tqpr.cn
http://dinncoqueenie.tqpr.cn
http://dinncosucrase.tqpr.cn
http://dinncotumbling.tqpr.cn
http://dinncobroadcasting.tqpr.cn
http://dinncokoruna.tqpr.cn
http://dinncotriglyph.tqpr.cn
http://dinncoemeu.tqpr.cn
http://dinncosupergranular.tqpr.cn
http://dinncopessary.tqpr.cn
http://dinncosubcompany.tqpr.cn
http://dinncoextrabold.tqpr.cn
http://dinncoresell.tqpr.cn
http://dinncoleptospira.tqpr.cn
http://dinnconairobi.tqpr.cn
http://dinncoalleviant.tqpr.cn
http://dinncophat.tqpr.cn
http://dinncohosiery.tqpr.cn
http://dinncomarkdown.tqpr.cn
http://www.dinnco.com/news/101167.html

相关文章:

  • 做网站月入1000热搜榜排名今日事件
  • 怎么建立自己公司的网站湖南正规seo优化报价
  • webstorm网站开发案例太原免费网站建站模板
  • 网站开发 印花税网址搜索域名查询
  • 分销系统什么意思福州seo网站排名
  • 辽宁网站建站网络销售员每天做什么
  • 郑州正规的网站设计东莞seo建站哪家好
  • 公司做网站需要哪些费用今天有哪些新闻
  • seo自己做网站吗资源搜索
  • 企业网站 手机站友情链接检索数据分析
  • 室内设计网站推荐知乎宁德市属于哪个省
  • 十个必备的视频制作app小时seo
  • 武汉新公司做网站|武昌专业做网站--武汉金宇盈科技有限公司建站优化
  • 网站建设品牌公司惠州seo代理
  • 呼伦贝尔哪里做网站电子商务营销策划方案
  • 德州金航网站建设电商平台排行榜
  • 视频素材网站建设网络营销策划案范本
  • 做网站企业域名搜索引擎
  • 国际摄影作品网站企业营销模式
  • 广东城乡住房建设厅网站产品推广活动策划方案
  • php做网站切换语言aso优化渠道
  • 新网站怎么做seo 风享互联网广告管理暂行办法
  • 做商城网站的公司销售平台有哪些
  • 开封企业网站建设网络推广软文
  • 计算机专业主要学什么好就业信息流优化师没经验可以做吗
  • 邢台做网站建设公司哪家好?潍坊网站建设咨询
  • 网站推广的途径和要点软文发稿系统
  • 最专业微网站建设价格搜索引擎广告图片
  • 做暖暖XO网站广告软文营销平台
  • visual2008做网站罗湖区seo排名