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

Add webpack 5 import instructions to readme #240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ Import the default value from `pjax.esm.js` or `pjax.esm.min.js` as:
import Pjax from './dist/pjax.esm.js';
```

##### To import as ES module with Webpack 5 bundler
Copy link
Owner

@PaperStrike PaperStrike Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to not only webpack 5, but any tool that can parse the exports field well, so it's better if you widen that description. And import it this way is actually preferred, so the description could be like:

# Pick a script in `dist` folder

## Automatic Pick

[[description]]

<script src="@sliphua/pjax"></script>

or

import Pjax from '@sliphua/pjax';

## To declare globally

…

## To import as ES module

…


```js
import Pjax from '@sliphua/pjax'
```

## What Pjax Does

_In short, ONE fetch with a `pushState` call._
Expand Down