@prefresh/webpack
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/prefresh__webpack package

4.0.3 • Public • Published

Prefresh-webpack

npm version

Setup

npm i -s @prefresh/webpack
## OR
yarn add @prefresh/webpack

Then add it to your webpack config by doing

import PreactRefreshPlugin from '@prefresh/webpack';

const config = {
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new PreactRefreshPlugin(),
  ],
  devServer: {
    hot: true, // ensure dev-server.hot is on
    ...moreDevServerConfig,
  },
  ...moreWebpackConfig,
};

Using hooks

If you're using preact/hooks you'll need something extra to ensure we can handle changes in hooks well.

You'll need to add @prefresh/babel-plugin to your babel-configuration to make this work together.

Best practices

Recognition

We need to be able to recognise your components, this means that components should start with a capital letter and hook should start with use followed by a capital letter. This allows the Babel plugin to effectively recognise these.

Do note that a component as seen below is not named.

export default () => {
  return <p>Want to refresh</p>;
};

Instead do:

const Refresh = () => {
  return <p>Want to refresh</p>;
};

export default Refresh;

When you are working with HOC's be sure to lift up the displayName so we can recognise it as a component.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.0.3
4,130latest

Version History

VersionDownloads (Last 7 Days)Published
4.0.3
4,130
4.0.2
4,759
4.0.1
1,072
4.0.0
8,504
3.3.418,654
3.3.31,908
3.3.2900
3.3.13
3.3.043
3.2.30
3.2.233
3.2.11
3.2.00
3.1.05
3.0.120
3.0.05
2.4.012
2.3.00
2.2.20
2.2.18
2.2.03
2.1.04
2.0.00
1.1.0371
1.0.28
1.0.10
1.0.00
0.9.114
0.9.00
0.8.2153
0.8.117
0.8.08
0.7.16
0.7.01
0.6.07
0.5.00

Package Sidebar

Install

npm i @prefresh/webpack

Weekly Downloads

40,649

Version

4.0.3

License

MIT

Unpacked Size

32 kB

Total Files

12

Last publish

Collaborators

  • jdecroock
  • marvinhagemeister
  • developit