You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, you can use loaders to tell webpack to load a CSS file or to convert TypeScript to JavaScript. Firstly, install the corresponding loaders:
Secondly, configure in your `webpack.config.js` that for every `.css`file the `css-loader` should be used and analogously for `.ts`files and the `ts-loader`:
Loaders follow the standard [module resolution](/concepts/module-resolution/). In most cases you will be loaders from the [module path](/concepts/module-resolution/#module-paths) (think `npm install`, `node_modules`).
76
67
77
68
[How to write a loader?](/development/how-to-write-a-loader) A loader module is expected to export a function and to be written in Node.js compatible JavaScript. In the common case you manage loaders with npm, but you can also have loaders as files in your app.
Copy file name to clipboardExpand all lines: content/configuration/entry-context.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ contributors:
7
7
- tarang9211
8
8
---
9
9
10
-
The entry object is where webpack looks to start building the bundle. The context is an absolute string to the directory that contains the entry files.
T> 要运行本地安装的 webpack,你可以通过 `node_modules/.bin/webpack` 访问其 bin 版本
48
36
49
37
50
-
<<<<<<< HEAD
51
-
### 前沿领域
52
-
=======
53
-
### Global Installation
38
+
### 全局安装
54
39
55
-
W> Note that a global webpack installation is not a recommended practice. This locks you down to a specific version of webpack and might fail in projects that use a different version.
| 按需加载附加模块 |**yes**|**yes**| no |[System.import](https://github.com/systemjs/systemjs/blob/master/docs/system-api.md#systemimportmodulename--normalizedparentname---promisemodule)| no | no |
34
-
| AMD `define`|**yes**|**yes**|[deamdify](https://github.com/jaredhanson/deamdify)| yes | no | yes |
33
+
| 附加模块按需加载 |**yes**|**yes**| no |[System.import](https://github.com/systemjs/systemjs/blob/master/docs/system-api.md#systemimportmodulename--normalizedparentname---promisemodule)| no | no |
| Node.js 其他 | process, __dir/filename, global | - | process, __dir/filename, global | process, __dir/filename, global for cjs | global ([commonjs-plugin](https://github.com/rollup/rollup-plugin-commonjs)) |
53
+
| Node.js 内置 libs `require("path")`|**yes**| no |**yes**|**yes**|[node-resolve-plugin](https://github.com/rollup/rollup-plugin-node-resolve)||
54
+
| Node.js 其他 | process, __dir/filename, global | - | process, __dir/filename, global | process, __dir/filename, global for cjs | global ([commonjs-plugin](https://github.com/rollup/rollup-plugin-commonjs)) ||
| 浏览器替换 |`web_modules`, `.web.js`, package.json field, alias config option | alias option | package.json field, alias option | package.json, alias option | no |
57
+
| 浏览器替换 |`web_modules`, `.web.js`, package.json field, alias config option | alias option | package.json field, alias option | package.json, alias option | no ||
| Additional chunks are loaded on demand |**yes**|**yes**| no |[System.import](https://github.com/systemjs/systemjs/blob/master/docs/system-api.md#systemimportmodulename--normalizedparentname---promisemodule)| no | no |
| Multi pages build with common bundle | with manual configuration |**yes**| with manual configuration | with bundle arithmetic | no | no|
89
-
| Multiple bundles |**yes**| with manual configuration | with manual configuration | yes | no | yes |
90
-
| Node.js built-in libs `require("path")`|**yes**| no |**yes**|**yes**|[node-resolve-plugin](https://github.com/rollup/rollup-plugin-node-resolve)||
91
-
| Other Node.js stuff | process, __dir/filename, global | - | process, __dir/filename, global | process, __dir/filename, global for cjs | global ([commonjs-plugin](https://github.com/rollup/rollup-plugin-commonjs)) ||
| Replacement for browser |`web_modules`, `.web.js`, package.json field, alias config option | alias option | package.json field, alias option | package.json, alias option | no ||
95
-
| Requirable files | file system |**web**| file system | through plugins | file system or through plugins | file system |
96
-
| Runtime overhead |**243B + 20B per module + 4B per dependency**| 14.7kB + 0B per module + (3B + X) per dependency | 415B + 25B per module + (6B + 2X) per dependency | 5.5kB for self-executing bundles, 38kB for full loader and polyfill, 0 plain modules, 293B CJS, 139B ES2015 System.register before gzip |**none for ES2015 modules** (other formats may have) ||
97
-
| Watch mode | yes | not required | yes | not needed in dev | no | yes |
98
-
99
-
♦ in production mode (opposite in development mode)
0 commit comments