Webpack

无套路,再送一波“阳光普照”

自古美人都是妖i 提交于 2021-02-08 14:50:46
今年推送了200+的文章: 精选文章汇总 ,阅读量都还不错。 感谢 前端试炼公众号 所有粉丝们这一年的支持!再送一波福利,参与方式非常简单。 这次的奖品不大,但是多啊! 阳光普照 ,不用是欧皇,只要动动手,就极大概率可以获得一份奖品。 参与方式 本活动最终解释权归小炼所有,拒绝羊毛党。 多种参与方式任君挑选。当然,你都参加也是可以的。 开奖时间:2月10日 22:00,发奖时间:年后开工之后 留言 本文 留言 任意内容,点赞数排名,快拉上你的朋友、同事点赞! No.1 : 《Webpack实战:入门、进阶与调优》 * 1 No.2 : 16.66 元红包 * 1 No.3 : 6.66 元红包 * 1 除此之外,前 10 名 掘金小册 6 折优惠码 * 1 在看 本文点击 文末在看 ,随机抽取,得加小炼好友哈,要不然小炼看不到。。 《JavaScript 语言精粹》 * 1 6.66 元红包 * 3 掘金小册 6 折优惠码 * 10 朋友圈 2月8日 12:00 小炼会在朋友圈发一条状态,点赞评论,简单直接 第 1 个点赞的 : 16.66 元红包 * 1 第 66 个点赞的 : 《学习 JavaScript 数据结构与算法》 * 1 第 50-100 点赞 : 1.66 元红包 * 1 前 30 个评论 : 掘金小册 6 折优惠码 * 1 手气红包 老规矩,逢年过节

PDFmake: pdfmake.createPdf is not a function

二次信任 提交于 2021-02-08 13:42:28
问题 After installing pdfmake using npm: npm install pdfmake --save-dev and compiling bundles with webpack I get an error when running: pdfmake = require 'pdfmake' pdfmake.createPdf(doc_definition).download('test.pdf') Saying: pdfmake.createPdf is not a function I've read this suggestion, installed the script-loader and changed the requirement to: pdfmake = require 'script!pdfmake' But that gave even more errors. Besides, I wouldn't know what that script loader would be needed. Any suggestions?

PDFmake: pdfmake.createPdf is not a function

情到浓时终转凉″ 提交于 2021-02-08 13:42:28
问题 After installing pdfmake using npm: npm install pdfmake --save-dev and compiling bundles with webpack I get an error when running: pdfmake = require 'pdfmake' pdfmake.createPdf(doc_definition).download('test.pdf') Saying: pdfmake.createPdf is not a function I've read this suggestion, installed the script-loader and changed the requirement to: pdfmake = require 'script!pdfmake' But that gave even more errors. Besides, I wouldn't know what that script loader would be needed. Any suggestions?

“You require appropriate loaders”, Using react native and expo. App fails to compile on the web, but runs on android

喜夏-厌秋 提交于 2021-02-08 13:27:09
问题 I'm using react native expo. The app works fine on android, but when run on the web gets a compilation error. It was working fine in before, but I suspect this started after installing some new package. /ReactNativeFrontend/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js 13:12 Module parse failed: Unexpected token (13:12) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https:/

NextJS reduce First Load of shared JS

我们两清 提交于 2021-02-08 11:33:26
问题 In a bigger project, I have a fairly high amount of used third-party libraries, including firebase, redux, etc and some more specific ones (but only used on several pages) like konvaJS, jimp, .... I just migrated recently to nextJS to speed up the website & maybe allow SSR. However, after migrating, the Lighthouse Speedtest dropped compared to the Pure React Version. The main problem seems to be the shared JS first Load bundles. After some optimizing, including lazy loading bigger Components

Got “Blocked:mixed content” on HTTPS website

独自空忆成欢 提交于 2021-02-08 11:31:31
问题 What is the current behavior? I'm Running a Website using Webpack in Production. I was surprised to see in Chrome console the following error about loading the js file which is mixed with weback and laravel-mix My questions: How can we have a mixed content on a website loaded using HTTPS protocol? How can I fix the error? I don't plan to serve website over HTTP and I want my js to load properly both in development and production. 回答1: From MDN documentation on mixed content To fix this type

Minify multiple javascript files with webpack

喜夏-厌秋 提交于 2021-02-08 11:21:32
问题 I am new to webpack. I wish to minify all files in a folder to single js using webpack. I don't wish to add all files name manually one by one in entry section. I am quite sure there must be a clean way for that but I am unable to find that on google or webpack official documentation. Please help. 回答1: This might work: const glob = require("glob"); module.exports = { entry: glob.sync("./src/*.js") }; 来源: https://stackoverflow.com/questions/42710170/minify-multiple-javascript-files-with

Serverless+Webpack: include .pem files in ZIP

僤鯓⒐⒋嵵緔 提交于 2021-02-08 10:57:29
问题 I try to deploy my lambda function to AWS using serverless. Everything works fine but the function cannot be executed because two files are not found (thats what fs.readFileSync says). I include them with the following lines in the serverless.yml: provider: name: aws runtime: nodejs10.x stage: dev region: eu-central-1 package: exclude: - .env include: - src/config/push-cert.pem - src/config/push-key.pem When I look in the .zip file which is uploaded to S3, both .pem files are not included. I

Why is the vue <template> invalid with v-bind:src?

让人想犯罪 __ 提交于 2021-02-08 10:00:13
问题 I want to dynamically switch html content, so I used vue-loader src to import, but v-bind:src doesn't take effect at all. <template src="./app.html"></template> Ok,effective <template :src="getDOM(true)"></template> getDOM(a){ if(a){ return './app.html' } else { return './app2.html' } } Not active. So, what can I do to achieve this effect? 回答1: It seems like you need to use Vue dynamic components https://vuejs.org/v2/guide/components.html#Dynamic-Components You can make a couple of components

Why is the vue <template> invalid with v-bind:src?

别等时光非礼了梦想. 提交于 2021-02-08 09:58:51
问题 I want to dynamically switch html content, so I used vue-loader src to import, but v-bind:src doesn't take effect at all. <template src="./app.html"></template> Ok,effective <template :src="getDOM(true)"></template> getDOM(a){ if(a){ return './app.html' } else { return './app2.html' } } Not active. So, what can I do to achieve this effect? 回答1: It seems like you need to use Vue dynamic components https://vuejs.org/v2/guide/components.html#Dynamic-Components You can make a couple of components