Skip to content

Commit

Permalink
make sure browser webpack uses dist browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinse12 committed Feb 14, 2024
1 parent 9425223 commit 8bc0905
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 200 deletions.
10 changes: 10 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ export default {

module: {
rules: [
// Need to make sure all webpacked files are using browser files
{
test: /\.js$/,
loader: 'string-replace-loader',
options: {
search: 'dist/node',
replace: 'dist/browser',
flags: 'g',
},
},
// plebbit-js doesn't need babel, but we should write our tests
// with it to make sure it doesn't break for users who use it
// like react users for example
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@
"hooks": {
"pre-commit": "lint-staged"
}
},
"devDependencies": {
"string-replace-loader": "3.1.0"
}
}
2 changes: 1 addition & 1 deletion test/node-and-browser/protocol.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import chaiString from 'chai-string'
const {expect} = chai
chai.use(chaiString)

import Plebbit from '@plebbit/plebbit-js'
import Plebbit from '@plebbit/plebbit-js/dist/node/index'
import * as cborg from 'cborg'
import {create as CreateKuboRpcClient} from 'kubo-rpc-client'
import {encryptEd25519AesGcm, decryptEd25519AesGcm} from '../utils/encryption'
Expand Down
Loading

0 comments on commit 8bc0905

Please sign in to comment.