Skip to content

Commit 177b3b4

Browse files
authored
Merge pull request #3 from Rareloop/update-webpack-wasm
Update webpack wasm usage of CopyPlugin to migrate through breaking i…
2 parents 52da5fd + a39bec9 commit 177b3b4

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const webpack = require('webpack');
2+
const CopyPlugin = require('copy-webpack-plugin');
3+
4+
module.exports = {
5+
mode: 'production',
6+
plugins: [
7+
new webpack.NormalModuleReplacementPlugin(/^typeorm$/, function (result) {
8+
result.request = result.request.replace(/typeorm/, 'typeorm/browser');
9+
}),
10+
new webpack.ProvidePlugin({
11+
'window.SQL': 'sql.js',
12+
}),
13+
// Copy the wasm file to the output dir
14+
new CopyPlugin([{ from: '../../../sql.js/dist/sql-wasm.wasm' }]),
15+
],
16+
node: {
17+
fs: 'empty',
18+
},
19+
};

projects/ionic-typeorm/config/webpack.wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
'window.SQL': 'sql.js',
1212
}),
1313
// Copy the wasm file to the output dir
14-
new CopyPlugin([{ from: '../../../sql.js/dist/sql-wasm.wasm' }]),
14+
new CopyPlugin({ patterns: [{ from: '../../../sql.js/dist/sql-wasm.wasm' }] }),
1515
],
1616
node: {
1717
fs: 'empty',

projects/ionic-typeorm/docs/install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,11 @@ In `angular.json`
7777
}
7878
}
7979
```
80+
81+
Important: If you are using `@ionic/angular-toolkit@2.3.1` or earlier then it will be using `copy-webpack-plugin@5` which requires a breaking difference within `webpack.wasm.js`. In this case the `production` path should be to:
82+
83+
``` json
84+
"customWebpackConfig": {
85+
"path": "node_modules/@rareloop/ionic-typeorm/config/webpack.2.3.1.wasm.js"
86+
},
87+
```

projects/ionic-typeorm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rareloop/ionic-typeorm",
3-
"version": "0.0.17",
3+
"version": "0.0.18",
44
"description": "",
55
"license": "MIT",
66
"author": "Rareloop",

0 commit comments

Comments
 (0)