Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: introduce about webpack #2434

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,40 @@ export default () => {
);
};
```
# Web configuration

## Metro bundler
bohdanprog marked this conversation as resolved.
Show resolved Hide resolved
No additional steps are required when using Metro bundler.

## Webpack
If you are using the Webpack bundler, the following steps are needed:

- Install `@react-native/assets-registry/registry` as a project dependency.
- Ensure that you have the proper configuration to parse flow files from `@react-native/assets-registry/registry`.
- Configure the Webpack `module -> rules` section and include an important rule for `node_modules/@react-native/assets-registry/registry`.

#### Webpack Configuration
bohdanprog marked this conversation as resolved.
Show resolved Hide resolved
```ts
const babelLoaderConfiguration = {
include: [
path.resolve(
appDirectory,
// Important!
'node_modules/@react-native/assets-registry/registry',
),
],
...
};

module.exports = {
...config,
module: {
rules: [babelLoaderConfiguration],
},
};
```

For more details on the complete Webpack configuration, you can refer to this [documentation](https://necolas.github.io/react-native-web/docs/multi-platform/#compiling-and-bundling) on how to set up a `webpack.config` file for React Native Web.

# Use with svg files

Expand Down
Loading