Integration with create-react-app
See original GitHub issueHi, you made a good job. I’ve found a problem with create-react-app
and i hope you help me)
When i try use argon2-browser
with my app, which was initialised from create-react-app
. So that create-react-app
has a only hide webpack config, i’ve used react-app-rewired
to customise it config. Problems: usage process: false
dont allowed in create-react-app, because some packadges depend from it, and also i common use the process
to acces env variables. If add your suggested config(without process
redefining), i have a error __webpack_public_path__ is not defined
. Example of problem create-react-app's
project bellow
package.json:
{ "name": "myapp", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.4.0", "@testing-library/user-event": "^7.2.1", "argon2-browser": "^1.12.0", "react": "^16.12.0", "react-app-rewired": "^2.1.5", "react-dom": "^16.12.0", "react-scripts": "3.3.0" }, "scripts": { "start": "react-app-rewired start" }, "eslintConfig": { "extends": "react-app" }, "devDependencies": { "base64-loader": "^1.0.0" } }
config-overrides.js:
module.exports = { webpack: function(config, env) { config.module = { ...config.module, noParse: [/\.wasm$/], rules: [ ...config.module.rules, { test: /\.wasm$/, type: 'javascript/auto', loaders: ['base64-loader'] } ] } config.node = { ...config.node, __dirname: false, fs: 'empty', Buffer: false, }; return config } }
usage:
import React from 'react'; import ReactDOM from 'react-dom'; const argon2 = require('argon2-browser') argon2.hash({ pass: 'password', salt: 'somesalt' }) .then(h => console.log(h.hash, h.hashHex, h.encoded)) .catch(e => console.error(e.message, e.code)) ReactDOM.render(<div>Hello</div>, document.getElementById('root'));
Thanks in advance
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Create a New React App
This is also the easiest way to integrate React into an existing website. ... Create React App is a comfortable environment for learning...
Read more >Integrating with an API Backend - Create React App
These tutorials will help you to integrate your app with an API backend running on another port, using fetch() to access it.
Read more >React-admin - Create_React-App Integration - Marmelab
Create -React-App is the standard way to bootstrap single-page React applications. That's also the recommended way to install and run react-admin. Setting Up ......
Read more >How To Set Up a React Project with Create React App
In this step, you'll create a new application using the npm package manager to run a remote script. The script will copy the...
Read more >Create a React app - Visual Studio (Windows) - Microsoft Learn
Create your app · In the Start window (choose File > Start Window to open), select Create a new project. · Search for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve figured out the problem. Latest push should be good.
Added a link to the readme.
Merry Christmas! 🎄