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

試著加入extension hot reload #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Getting Started with Create React App
# Google Extension

## 打包順序

1. 打包
```
```


```

```


<!-- npx webpack-extension-reloader --config craco.config.js --port 9080 --no-page-reload --content-script content.js --background background.js -->

<!-- --extension-page popup.js -->


This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

Expand Down
16 changes: 15 additions & 1 deletion craco.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const ExtensionReloader = require('webpack-extension-reloader');

module.exports = {
webpack: {
configure: (webpackConfig, {env, paths}) => {
Expand All @@ -16,7 +18,19 @@ module.exports = {
optimization: {
...webpackConfig.optimization,
runtimeChunk: false,
}
},
plugins: [
// https://github.com/rubenspgcavalcante/webpack-extension-reloader
new ExtensionReloader({
port: 9090, // Which port use to create the server
reloadPage: true, // Force the reload of the page also
entries: { // The entries used for the content/background scripts or extension pages
contentScript: 'content-script',
background: 'background',
extensionPage: 'popup',
}
}),
]
}
},
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"webpack-extension-reloader": "^1.1.4"
}
}
Loading