Webpack

Is it possible to import css file conditionally in Vue.js?

吃可爱长大的小学妹 提交于 2021-01-20 07:20:41
问题 I have my admin-panel and pages for clients in one Vue.js project . Is it possible to use certain css-files only if the current route has "forAdmin" meta? 回答1: By using style-loader with the useable API, you can dynamically apply and remove a stylesheet in your code. First you'll need to update your webpack config rules so that stylesheets with the .useable.css extension will be loaded with the useable API: { test: /\.css$/, exclude: /\.useable.css$/, use: [ 'style-loader', 'css-loader' ] },

Node error when I run npm with laravel breeze

时光毁灭记忆、已成空白 提交于 2021-01-20 06:25:32
问题 I have this error when I run npm run dev or npm run watch and I didn't find what is the mess. It's happens in a all fresh Laravel 8 app. It looks like happen when I use the developement command ERROR in ./resources/css/app.css Module build failed (from ./node_modules/css-loader/index.js): ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js): TypeError: [(...variantsValue),(...extensions)].flat is not a function at /var/www/html/smart_recipe/node_modules

access-vue-admin管理后台使用

淺唱寂寞╮ 提交于 2021-01-18 12:55:47
关于 access-vue-admin access-vue-admin 是一套企业级的高颜值、高性能的通用型中后台前端解决方案,它基于 vue2.5开发,并内置了element ui,使用最前沿的前端技术栈,支持各类型产品,比如典型的中后台应用(类阿里云后台、七牛云后台,各类 to B 产品)、社区型应用(类知乎、论坛、门户)(需使用社交布局)、地图型应用(需使用地图布局)、工作桌面型应用(需使用工作桌面布局)等。 在线预览 其他好用快捷开发框架 登录 账号:admin 密码:123456 产品特点 丰富的布局模式可选择,布局和功能具有高可配性; 支持顶栏菜单和侧边栏菜单(侧边菜单自动响应顶栏菜单变化,支持动态菜单); 漂亮的 UI、极致的用户体验和细节处理; 产品功能 登录 顶栏菜单和侧边栏菜单(支持自动响应,支持动态菜单) 可配置的菜单栏徽标 布局(经典布局,全响应式后期开发) 亮色 / 暗色 侧边栏 亮色 顶栏 可折叠侧边栏 多页签 全局面包屑 更多布局可在线体验(右上角菜单项可动态预览各种配置) 支持内嵌页面 重载当前页面 动态路由支持自动重载 支持多级路由嵌套及菜单栏嵌套 分离路由与菜单设置 富文本编辑器 优秀的持久化存储方案 自定义登录重定向 tag切换新增拖拽位置跟右键关闭 webpack性能打包优化 table的换列操作 支持单table

早读君有约

两盒软妹~` 提交于 2021-01-18 10:32:50
hi,大家圣诞节快乐!不知道大家苹果吃了吗? 第二期有约是在杭州参加D2写的,第三期有约将在边听《我可以抱着你吗?》边写,平时在写代码的时候,你一般都什么类型的歌,我有时候只是戴着耳机,但里面并没有放歌。 本周3篇来自前端早读课专栏,推荐一本电子工业出版社图书,一条厦门4399UED的招聘信息,其他的且慢慢看来。 本周又连载《你不懂JS》系列的文章,看评论,有的说翻译好,有的说翻译生硬,有的会说太长。在文章太长方面,这个我会继续想办法解决这个问题。不知道大家有什么好的方式呢,可以继续留言讨论。 ps:抛出问题的时候,可以适当的想想有没什么办法解决,这样就更棒了。 【第798期】你不懂JS:ES6与未来 语法(上) 从公众号后台关键字消息来看,大家发送Vue这个次数还是很大,大概会是react的两倍多。目前三大马车齐驱的时代,本周还是推送了一篇react组件化相关的文章。组件化,模块化的话题,这个让我想起上周D2上的@远舟的分享,很值得大家去看下它的PPT,我是被他解藕思路感动到。大家可以回复 react 查看该专题。 【第799期】重新设计 React 组件库 再来说说构建工具,从2~3年grunt的串红,到现在 webpack,以及现在有几家公司在尝试的rollup来构建。webpack一贯被官方文档没法看著称(不知道现在有没改善)。所以在webpack构建工具分享上

rollup是面向library的?!

醉酒当歌 提交于 2021-01-17 14:52:47
写在前面 Rollup was designed with libraries rather than apps in mind, and it is a perfect fit for React’s use case. 在Behind the Scenes: Improving the Repository Infrastructure – React Blog看到了这个,有些惊讶,这样好的东西,为什么只是面向类库呢?什么原因致使它不适合用来构建App? 零.webpack webpack致力于复杂SPA的模块化构建,非常吸引人的是各种loader: Essentially, webpack loaders transform all types of files into modules that can be included in your application’s dependency graph. 以一致的方式处理各种资源依赖,通过loader屏蔽掉了资源类型差异(js是module,css是module,img也是module……),优势如下: No more carefully placing your files in the right folders and hacked-together scripts for adding hashes to file

Module not found: Error: Can't resolve 'util' in webpack

…衆ロ難τιáo~ 提交于 2021-01-15 18:10:13
问题 when i run the script it show me this errors Here is error: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill , you need to: add a fallback 'resolve.fallback: { "util" : require.resolve(" util /") }', install 'util' ; If you don't want to include a polyfill, you can use an empty module like this:resolve.fallback: { "util" :

Module not found: Error: Can't resolve 'util' in webpack

社会主义新天地 提交于 2021-01-15 18:09:49
问题 when i run the script it show me this errors Here is error: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill , you need to: add a fallback 'resolve.fallback: { "util" : require.resolve(" util /") }', install 'util' ; If you don't want to include a polyfill, you can use an empty module like this:resolve.fallback: { "util" :

Module not found: Error: Can't resolve 'util' in webpack

…衆ロ難τιáo~ 提交于 2021-01-15 18:09:18
问题 when i run the script it show me this errors Here is error: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill , you need to: add a fallback 'resolve.fallback: { "util" : require.resolve(" util /") }', install 'util' ; If you don't want to include a polyfill, you can use an empty module like this:resolve.fallback: { "util" :

Module not found: Error: Can't resolve 'util' in webpack

巧了我就是萌 提交于 2021-01-15 18:05:50
问题 when i run the script it show me this errors Here is error: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill , you need to: add a fallback 'resolve.fallback: { "util" : require.resolve(" util /") }', install 'util' ; If you don't want to include a polyfill, you can use an empty module like this:resolve.fallback: { "util" :

如何在 Vite 中使用 Element UI + Vue 3

↘锁芯ラ 提交于 2021-01-15 18:05:23
在上篇文章 《2021新年 Vue3.0 + Element UI 尝鲜小记》 里,我们尝试使用了 Vue CLI 创建 Vue 3 + Element UI 的项目,而 Vue CLI 实际上为我们生成了一个我们熟悉的 Webpack 工程项目。 Webpack 无需过多介绍,一个十分强大的打包工具。但 Webpack 也有不足的地方,比如第一次打包需要很长时间,修改代码之后的热更新速度较慢。 随着 Vue 3 一起推出的还有一个强大的新一代打包工具 Vite, 一个面向现代浏览器,基于原生模块系统 ESModule 实现了按需编译的 Web 开发构建工具,恰恰就解决了上述 Webpack 的痛点。Vite 主要的优势有三点: 快速冷启动服务器 即时热模块更换(HMR) 真正的按需编译 听上去就很不错,立刻上手尝试一下。 初始化 Vite 项目 使用 npm init @vitejs/app my-vue-app --template vue 命令快速生成一个使用 Vite 构建的 Vue 3 项目模版。 运行 npm run dev 即可把项目跑起来,进入开发模式。项目冷启动速度非常快,不到 1 秒钟,浏览器里就已经出现项目预览了。项目冷启动只用了 382ms ,真香。 引入 Element Plus UI 组件库 开发项目,首先要挑选一个 UI 组件库。目前市面上支持 Vue