美文网首页
webpack模块

webpack模块

作者: 炎武森禄 | 来源:发表于2017-02-26 10:37 被阅读0次

In modular programming, developers break programs up into discrete chunks of functionality called a module.

Each module has a smaller surface area than a full program, making verification, debugging, and testing trivial.
Well-written modules provide solid abstractions and encapsulation boundaries, so that each module has a coherent design and a clear purpose within the overall application.

Node.js has supported modular programming almost since its inception.
On the web, however, support for modules has been slow to arrive.
Multiple tools exist that support modular JavaScript on the web, with a variety of benefits and limitations.
webpack builds on lessons learned from these systems and applies the concept of modules to any file in your project.

What is a webpack Module

In contrast to Node.js modules, webpack modules can express their dependencies in a variety of ways. A few examples are:

  • An ES2015 import statement
  • A CommonJS require() statement
  • An AMD define and require statement
  • An @import statement inside of a css/sass/less file.
  • An image url in a stylesheet (url(...)) or html (<img src=...>) file.

T> webpack 1 requires a specific loader to convert ES2015 import, however this is possible out of the box via webpack 2

Supported Module Types

webpack supports modules written in a variety of languages and preprocessors, via loaders. Loaders describe to webpack how to process non-JavaScript modules and include these dependencies into your bundles.
The webpack community has built loaders for a wide variety of popular languages and language processors, including:

And many others! Overall, webpack provides a powerful and rich API for customization that allows one to use webpack for any stack, while staying non-opinionated about your development, testing, and production workflows.

For a full list, see the list of loaders or write your own.

相关文章

  • webpack学习笔记

    什么是webpack? webpack是一个模块管理工具,用webpack可以管理模块依赖,并编译模块所需的静态文...

  • Webpack4-其他概念

    模块 什么是 webpack 模块 对比 Node.js 模块,webpack 模块能够以各种方式表达它们的依赖关...

  • webpack-compiler篇

    1、webpack核心模块——compiler Compiler模块是 webpack 的支柱引擎,它通过CLI或...

  • webpack 入门

    webpack 是什么? webpack是模块化管理工具,使用webpack可以对模块进行压缩、预处理、按需打包、...

  • webpack 入门

    webpack 是什么? webpack是模块化管理工具,使用webpack可以对模块进行压缩、预处理、按需打包、...

  • WEBPACK 入门

    1. 什么是webpack 官网介绍:webpack是一个模块打包器。webpack 处理带有依赖关系的模块,生成...

  • webpack面试题汇总

    什么是webpack webpack是一个打包模块化javascript的工具,在webpack里一切文件皆模块,...

  • webpack4.0 resolve的使用

    webpack在启动后会从配置的入口模块触发找出所有依赖的模块,Resolve配置webpack如何寻找模块对应的...

  • webpack的使用

    什么是webpack 简单来说webpack就是一种模块加载器兼打包工具。侧重于模块加载 webpack如何使用 ...

  • webpack

    webpack是什么? webpack将静态资源称之为模块。webpack是一个模块打包工具,可以兼容多种js书写...

网友评论

      本文标题:webpack模块

      本文链接:https://www.haomeiwen.com/subject/okrowttx.html