Webpack

How to 'require' an xml file (loaded by webpack) in order to read the xml contents in javascript

拜拜、爱过 提交于 2021-01-27 11:27:34
问题 I'm using webpack as the bundler for a app and using an XML file for it configuration. Currently I'm writing tests to retrieve the config from an XML file packaged by webpack. Referencing this webpack article: Loading data the piece of code I'm having trouble is this: import Data from './data.xml'; I'm my own test, I'm using the require form which is as follows: const select = require('xpath.js'); const DOMParser = require('xmldom').DOMParser const parser = new DOMParser(); const data =

How to 'require' an xml file (loaded by webpack) in order to read the xml contents in javascript

。_饼干妹妹 提交于 2021-01-27 11:26:24
问题 I'm using webpack as the bundler for a app and using an XML file for it configuration. Currently I'm writing tests to retrieve the config from an XML file packaged by webpack. Referencing this webpack article: Loading data the piece of code I'm having trouble is this: import Data from './data.xml'; I'm my own test, I'm using the require form which is as follows: const select = require('xpath.js'); const DOMParser = require('xmldom').DOMParser const parser = new DOMParser(); const data =

Vue CLI3 开启gzip压缩

℡╲_俬逩灬. 提交于 2021-01-27 08:28:48
本文转载于: 猿2048 网站 https://www.mk2048.com/blog/blog.php?id=0ak2j&title=Vue+CLI3+%E5%BC%80%E5%90%AFgzip%E5%8E%8B%E7%BC%A9 gizp压缩是一种http请求优化方式,通过减少文件体积来提高加载速度。html、js、css文件甚至json数据都可以用它压缩,可以减小60%以上的体积。 webpack在打包时可以借助 compression webpack plugin 实现gzip压缩,首先需要安装该插件: npm i -D compression-webpack-plugin 在vue cli3.0 生成的项目里,可在 vue.config.js 中按照如下方式进行配置: 压缩前后大小大致如下: 生成的压缩文件以.gz为后缀: 一般浏览器都已支持.gz的资源文件,在http请求的Request Headers 中能看到 Accept-Encoding:gzip 要使服务器返回.gz文件,还需要对服务器进行配置,根据Request Headers的Accept-Encoding标签进行鉴别,如果支持gzip就返回.gz文件。over 本文转载于: https://www.mk2048.com/blog/blog.php?id=0ak2j&title=Vue+CLI3+%E5

ng serve --proxy-config with NTLM authentication is not working

你。 提交于 2021-01-27 07:43:32
问题 I'm trying to get angular cli's internal webserver (webpack uses node-http-proxy I think) to work with NTLM authentication and coming up short. I set up the webpack proxy like this: // in packages.json ... "scripts": { "start": "ng serve --proxy-config proxy.conf.json", ... The contents of proxy.config.json is: { "/srv": { "target": "http://localhost/access_form", "logLevel": "debug", "auth": "LOGIN:PASS" } } I'm trying to add a onProxyRes function to the JSON options object but this fails to

Leaflet marker icon url compiled wrong while running ng build --prod

梦想的初衷 提交于 2021-01-27 07:41:18
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

南笙酒味 提交于 2021-01-27 07:41:11
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

佐手、 提交于 2021-01-27 07:40:27
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

故事扮演 提交于 2021-01-27 07:40:22
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

ng serve --proxy-config with NTLM authentication is not working

半腔热情 提交于 2021-01-27 07:39:51
问题 I'm trying to get angular cli's internal webserver (webpack uses node-http-proxy I think) to work with NTLM authentication and coming up short. I set up the webpack proxy like this: // in packages.json ... "scripts": { "start": "ng serve --proxy-config proxy.conf.json", ... The contents of proxy.config.json is: { "/srv": { "target": "http://localhost/access_form", "logLevel": "debug", "auth": "LOGIN:PASS" } } I'm trying to add a onProxyRes function to the JSON options object but this fails to

How to inject dotenv variables without REACT_APP prefix in create-react-app?

不羁岁月 提交于 2021-01-27 06:10:57
问题 I have a project to migrate from legacy React app to standard create-react-app one (not ejected). In legacy project, it manually loads .env files with dotenv and dotenv-expand and injects through webpack DefinePlugin . create-react-app intuitively supports dotenv but can only recognize variables with REACT_APP_ prefix. There are so many places in legacy code also along with imported packages in other repositories that are using process.env.xxx variables, so it is impossible for now to rename