Skip to content

Commit cc0a1ce

Browse files
authored
Update webpack (RustPython#5585)
* Update webpack * Build demo before notebook * Use with instead of env for actions-gh-pages
1 parent 58ebf04 commit cc0a1ce

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ jobs:
109109
- uses: actions/setup-node@v4
110110
- uses: mwilliamson/setup-wabt-action@v3
111111
with: { wabt-version: "1.0.30" }
112+
- name: build demo
113+
run: |
114+
npm install
115+
npm run dist
116+
env:
117+
NODE_OPTIONS: "--openssl-legacy-provider"
118+
working-directory: ./wasm/demo
112119
- name: build notebook demo
113120
run: |
114121
npm install
@@ -119,11 +126,11 @@ jobs:
119126
working-directory: ./wasm/notebook
120127
- name: Deploy demo to Github Pages
121128
uses: peaceiris/actions-gh-pages@v4
122-
env:
123-
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }}
124-
PUBLISH_DIR: ./wasm/demo/dist
125-
EXTERNAL_REPOSITORY: RustPython/demo
126-
PUBLISH_BRANCH: master
129+
with:
130+
deploy_key: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }}
131+
publish_dir: ./wasm/demo/dist
132+
external_repository: RustPython/demo
133+
publish_branch: master
127134

128135
release:
129136
runs-on: ubuntu-latest
@@ -161,4 +168,4 @@ jobs:
161168
--target="$tag" \
162169
--generate-notes \
163170
$PRERELEASE_ARG \
164-
bin/rustpython-release-*
171+
bin/rustpython-release-*

wasm/notebook/package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@
1212
"xterm": "^3.8.0"
1313
},
1414
"devDependencies": {
15-
"@wasm-tool/wasm-pack-plugin": "^1.1.0",
16-
"clean-webpack-plugin": "^3.0.0",
17-
"css-loader": "^3.4.1",
18-
"html-webpack-plugin": "^3.2.0",
19-
"mini-css-extract-plugin": "^0.9.0",
20-
"raw-loader": "^4.0.0",
21-
"serve": "^11.0.2",
22-
"webpack": "^4.16.3",
23-
"webpack-cli": "^3.1.0",
24-
"webpack-dev-server": "^3.1.5"
15+
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
16+
"css-loader": "^7.1.2",
17+
"html-webpack-plugin": "^5.6.3",
18+
"lezer-loader": "^0.3.0",
19+
"mini-css-extract-plugin": "^2.9.2",
20+
"webpack": "^5.97.1",
21+
"webpack-cli": "^6.0.1",
22+
"webpack-dev-server": "^5.2.0"
2523
},
2624
"scripts": {
27-
"dev": "webpack-dev-server -d",
25+
"dev": "webpack serve",
2826
"build": "webpack",
2927
"dist": "webpack --mode production",
3028
"test": "webpack --mode production && cd ../tests && pytest"

wasm/notebook/webpack.config.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const HtmlWebpackPlugin = require('html-webpack-plugin');
22
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
4-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
54

65
const path = require('path');
76
const fs = require('fs');
@@ -12,6 +11,7 @@ module.exports = (env = {}) => {
1211
output: {
1312
path: path.join(__dirname, 'dist'),
1413
filename: 'index.js',
14+
clean: true,
1515
},
1616
mode: 'development',
1717
resolve: {
@@ -30,15 +30,14 @@ module.exports = (env = {}) => {
3030
},
3131
{
3232
test: /\.(woff(2)?|ttf)$/,
33-
use: {
34-
loader: 'file-loader',
35-
options: { name: 'fonts/[name].[ext]' },
33+
type: 'asset/resource',
34+
generator: {
35+
filename: 'fonts/[name].[ext]',
3636
},
3737
},
3838
],
3939
},
4040
plugins: [
41-
new CleanWebpackPlugin(),
4241
new HtmlWebpackPlugin({
4342
filename: 'index.html',
4443
template: 'src/index.ejs',
@@ -58,6 +57,9 @@ module.exports = (env = {}) => {
5857
filename: 'styles.css',
5958
}),
6059
],
60+
experiments: {
61+
asyncWebAssembly: true,
62+
},
6163
};
6264
if (!env.noWasmPack) {
6365
config.plugins.push(

0 commit comments

Comments
 (0)