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
Configure how modules are resolved. For example, when calling `import "lodash"` in ES2015, the `resolve`options can change where webpack goes to look for `"lodash"`(see [`modules`](#resolve-modules)).
`index.js` may resolve to another file if defined in the `package.json`.
80
+
如果在 `package.json` 中定义,`index.js` 可能会被解析为另一个文件。
81
81
82
-
`/abc/node_modules`may resolve in `/node_modules`too.
82
+
`/abc/node_modules`也可能在 `/node_modules`中解析。
83
83
84
84
85
85
## `resolve.aliasFields`
86
86
87
87
`string`
88
88
89
-
Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec). Default:
If`true`, it will not allow extension-less files. So by default `require('./foo')`works if `./foo` has a `.js` extension, but with this enabled only `require('./foo.js')`will work. Default:
Automatically resolve certain extensions. This defaults to:
133
+
自动解析确定的扩展。默认值为:
134
134
135
135
```js
136
136
extensions: [".js", ".json"]
137
137
```
138
138
139
-
which is what enables users to leave off the extension when importing:
139
+
能够使用户在引入模块时不带扩展:
140
140
141
141
```js
142
142
importFilefrom'../path/to/file'
143
143
```
144
144
145
-
W> Using this will **override the default array**, meaning that webpack will no longer try to resolve modules using the default extensions. For modules that are imported with their extension, e.g. `import SomeFile from "./somefile.ext"`, to be properly resolved, a string containing "\*" must be included in the array.
145
+
W> 使用此选项,会**覆盖默认数组**,这就意味着 webpack 将不再尝试使用默认扩展来解析模块。对于使用其扩展导入的模块,例如,`import SomeFile from "./somefile.ext"`,要想正确的解析,一个包含“\*”的字符串必须包含在数组中。
0 commit comments