browserify

Can I start a socket.io/websocket server in browser?

徘徊边缘 提交于 2021-02-19 05:34:00
问题 There question about this before, the answer is no. But now, with browserify/webpack, can I just write code like I would on server and it will run in browser, or is there any restriction that would make this impossible? 回答1: No, you cannot. Starting a server in a browser requires access to low level functionality that simply to does not exist in a browser. Browserify cannot add fundamental low-level features to the browser that it does not have that would require additional native code

Is it possible to let webpack bundle CSS without import css in my entry js?

元气小坏坏 提交于 2021-02-19 02:41:48
问题 Importing CSS file in js is webpack-specific. If I use gulp+browserify I will need browserify-css . I feel uncomfortable with writing source code that directly depends on having browserify-css or webpack(especially I am not writing React/Vue app, just vanilla js). I find some Q&A related to this, e.g. import CSS and JS files using Webpack and Can I build sass/less/css in webpack without requiring them in my JS? They suggested multiple-entry-points config (if I understand them correctly), i.e.

Vue篇(001)-vue 中的性能优化

て烟熏妆下的殇ゞ 提交于 2021-02-14 21:38:07
答案: 1、Vue 应用运行时性能优化措施 (1)引入生产环境的 Vue 文件 (2)使用单文件组件预编译模板 (3)提取组件的 CSS 到单独到文件 (4)利用Object.freeze()提升性能 (5)扁平化 Store 数据结构 (6)合理使用持久化 Store 数据 (7)组件懒加载 2、Vue 应用加载性能优化措施 (1)服务端渲染 / 预渲染 (2)组件懒加载 得益于 Vue 的 响应式系统 和 虚拟 DOM 系统 ,Vue 在渲染组件的过程中能自动追踪数据的依赖,并精确知晓数据更新的时候哪个组件需要重新渲染,渲染之后也会经过虚拟 DOM diff 之后才会真正更新到 DOM 上,Vue 应用的开发者 一般不需要 做额外的优化工作。 但在实践中仍然有可能遇到性能问题,下面会介绍一些定位分析 Vue 应用性能问题的方式及一些优化的建议。 整体内容由三部分组成: 1、如何定位 Vue 应用性能问题 2、Vue 应用运行时性能优化建议 3、Vue 应用加载性能优化建议 1. 如何定位 Vue 应用性能问题 Vue 应用的性能问题可以分为两个部分,第一部分是运行时性能问题,第二部分是加载性能问题。 和其他 web 应用一样,定位 Vue 应用性能问题最好的工具是 Chrome Devtool,通过 Performance 工具可以用来录制一段时间的 CPU 占用、内存占用

React.js app.js file size

懵懂的女人 提交于 2021-02-07 07:22:39
问题 I created pretty simple react application containing 7 pages and 13 components. I am using gulp to compile it, browserify for dependencies, all files are minimized. My build'ed app.js file has 1.1 MB . I think it is quite big. What can I do to reduce its size ? Are there any good practices to achieve smallest size ? EDIT: My source code without dependencies is 91 KB . 回答1: Using webpack-uglify and disabling source maps can greatly improve the output to a reasonable size (~140kbs for a hello

React.js app.js file size

北战南征 提交于 2021-02-07 07:22:17
问题 I created pretty simple react application containing 7 pages and 13 components. I am using gulp to compile it, browserify for dependencies, all files are minimized. My build'ed app.js file has 1.1 MB . I think it is quite big. What can I do to reduce its size ? Are there any good practices to achieve smallest size ? EDIT: My source code without dependencies is 91 KB . 回答1: Using webpack-uglify and disabling source maps can greatly improve the output to a reasonable size (~140kbs for a hello

Is there an alternative to Browserify? [closed]

喜欢而已 提交于 2021-02-04 05:12:23
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Improve this question I want to generate client side JavaScript from Node.js. I found Browserify, but is there any other alternative to Browserify ? 回答1: Correct me if I'm wrong. As I understand it browserify is used to pre-process JavaScript into a format in which the browser can

Is there an alternative to Browserify? [closed]

主宰稳场 提交于 2021-02-04 05:11:55
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Improve this question I want to generate client side JavaScript from Node.js. I found Browserify, but is there any other alternative to Browserify ? 回答1: Correct me if I'm wrong. As I understand it browserify is used to pre-process JavaScript into a format in which the browser can

How to import jquery using ES6 syntax?

佐手、 提交于 2021-01-29 07:10:02
问题 I'm writing a new app using (JavaScript) ES6 syntax through babel transpiler and the preset-es2015 plugins, as well as semantic-ui for the style. index.js import * as stylesheet from '../assets/styles/app.scss'; import * as jquery2 from '../dist/scripts/jquery.min'; import * as jquery3 from '../node_modules/jquery/dist/jquery.min'; console.log($('my-app')); index.html <!DOCTYPE html> <html lang="fr"> <head> <body> <script src="dist/app.js"></script> </body> </html> Project structure . ├── app

Browserify not working with module.exports, even with --standalone option

谁说我不能喝 提交于 2021-01-07 02:49:38
问题 I have the following JS file: common.js : "use strict"; const MarketingPolicy = { Subscriptions: { // Some properties here. }, Campaigns: [ // Some objects here. ] }; const otherObject = { // Some properties here. }; module.exports = { otherObject, MarketingPolicy }; This works in Node.js: const common = require("./common.js"); const policy = common.MarketingPolicy; // No error. But when exporting it to common.bundle.js with Browserify , none of the objects is accessible at the client-side (

node.js on Windows frequently fails with 'EMFILE: too many open files'

孤人 提交于 2021-01-03 07:27:06
问题 When using various tools on Windows, eg browserify , I frequently see: Error: EMFILE: too many open files, open 'C:\Users\mike\Documents\myapp\node_modules\babel-polyfill\node_modules\core-js\package.json' at Error (native) Unlike Linux, where maximum open files is a soft limit that chan be changed, it seems EMFILE is a hard limit in Windows. How can I fix this? note : I have solved the problem, but it took a week and I couldn't find anything on the internet when I searched, so I'm about to