Files
xverse-web-extension/webpack/utils/devServer.js
Eduard Bardají Puig 27f74bebd9 [ENG-5120] Permissions support for web-extension (#619)
* Update initializer description

* WIP

* WIP

* WIP

* Partial progress consuming permissions from xverse-core

* More fixes

* Consume more permissions from xverse-core

* wip

* Update webpack

* Rename method variables

* WIP

* Update getCurrentPermissions response

* Update readme

* Add helpers

* Use permissions helpers

* Refactor getAddresses

* Refactor getAccounts

* Refactor signMessage

* Await and call perms

* Port stacks methods to permissions

* Update get stx accounts

* Update sign tx

* Add missing await

* Update transfer stx

* Finish stacks methods

* Update runes getBalance

* Update etch

* Migrate runes transfer

* Port handlers to router

* Add connect

* TO_REVERT: Remove Husky

* Add address purpose selector

* Update address type signature

* Handle connect requests

* Remove unused imports

* Add explainer

* Rename Xverse App

* Bump core

* Fix perms types

* Use entries

* wip

* re-org files + implement addresses + message params

* fix knip errors

* Revert package-lock.json to v2

* Use name helper

* Remove unnecessary no-op fn

* Rename file

* Rename file

* Map client names from origin

* Rename folder

* Remove unused comments

* Rename files

* Rename file

* Use app name

---------

Co-authored-by: Mahmoud Aboelenein <mahmoud@secretkeylabs.com>
2024-10-31 14:04:25 +00:00

61 lines
1.6 KiB
JavaScript

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
process.env.ASSET_PATH = '/';
var WebpackDevServer = require('webpack-dev-server'),
webpack = require('webpack'),
config = require('../webpack.config'),
env = require('../utils/env'),
path = require('path');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const excludeEntriesFromHotModuleReload = ['content-script', 'inpage', 'background'];
Object.keys(config.entry).forEach((entryName) => {
if (!excludeEntriesFromHotModuleReload.includes(entryName) && config.entry) {
config.entry[entryName] = [
`webpack-dev-server/client?hot=true&live-reload=true&hostname=localhost&port=${env.PORT}`,
'webpack/hot/dev-server',
].concat(config.entry[entryName]);
}
});
config.plugins = [
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin({ overlay: false }),
].concat(config.plugins || []);
var compiler = webpack(config);
var server = new WebpackDevServer(
{
webSocketServer: 'ws',
hot: false,
client: false,
host: 'localhost',
port: env.PORT,
static: {
directory: path.join(__dirname, '../build'),
},
devMiddleware: {
publicPath: `http://localhost:${env.PORT}/`,
writeToDisk: true,
},
headers: {
'Access-Control-Allow-Origin': '*',
},
allowedHosts: 'all',
},
compiler,
);
if (process.env.NODE_ENV === 'development' && module.hot) {
module.hot.accept();
}
(async () => {
await server.start();
})();