vue-loader

vue loader different loaders for one extension

女生的网名这么多〃 提交于 2019-12-08 07:27:14
问题 I'm currently trying to use SVG in my vue-loader/webpack template project. I need to load different kind of SVGs : Icons : used inside my components and loaded with svg-inline loader for inlining and customization with css. SVGImages : used inside img tag or background images loaded with url loader like the other images. I tried the following configuration inside webpack.base.conf.js : { test: /\.svg$/, oneOf: [ { resourceQuery: /ico/, // image.svg?ico, use: 'svg-inline-loader' }, {

node-sass 安装失败的各种坑

[亡魂溺海] 提交于 2019-12-06 02:00:58
开始的时候引入别人的一个项目 npm install npm run dev 启动项目 报错 > node build/dev-server.js Listening at http://localhost:8888 webpack: wait until bundle finished: /index.html webpack built 5301489d16ee90d86896 in 3165ms Hash: 5301489d16ee90d86896 Version: webpack 1.15.0 Time: 3165ms Asset Size Chunks Chunk Names app.js 1.96 MB 0 app ERROR in Cannot find module 'node-sass' @ ./src/common/scss/index.scss 4:14-124 13:2-17:4 14:20-130 ERROR in Cannot find module 'node-sass' @ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-e0c3a2e6!./~/sass-loader!./~/vue-loader/lib/selector.js

Components and Sub components

大憨熊 提交于 2019-12-05 18:30:42
I'm new to Vue.js and I'm having a bit of trouble using components with sub-components. I have the following .vue files app.vue <template> <section> <menu></menu> <h1>Create Your MIA</h1> <div id="board"></div> <slider> <skin></skin> </slider> </section> </template> slider.vue <template> <div id="slider-panel"> <h3>{{* heading}}</h3> <div class="slider"> <slot> Some content </slot> </div> </div> </template> <script> import skin from "./skin"; export default { components: { skin: skin } }; </script> skin.vue <template> <div v-for="colour in colours"> <div :style="{ backgroundColor: colour }">

vue中修改swiper样式

空扰寡人 提交于 2019-12-05 10:07:37
问题   vue单文件组件中无法修改swiper样式。 解决   1,单文件组件中:新增一个style 不加scoped 让它最终成为全局样式。只在其中操作swiper的样式。 <style lang="scss"> .swiper-container{ .swiper-pagination{ .swiper-pagination-bullet{ width: 14px; height: 14px; } } } </style>// 项目中多次使用swiper 的话 就给swiper-container 添加特定className作为区分。 <div class="swiper-container index-swiper"><div> <style> .index-wiper{} </style>  ,2,新建专用于操作swiper 样式的css, 在main.js中引入, 使用!import保证比swiper 预设样式权重高。 产生原因   1,单文件中的template,和style 都会经过vue-loader的编译。在style标签上使用了 scoped 属性的话,template中手写的元素和style之间会通过vue-loader生成的一个自定义属性,形成呼应关系,style只对对应的template起作用。编译过程中由swiper 生成的分页器标签不会经过vue

vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin

心不动则不痛 提交于 2019-12-05 03:57:28
场景: . webpack2.4.*集成vue-loader@15.7.2报错 原因: 参考官方文档 https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required Vue-loader在15.*之后的版本都是 vue-loader的使用都是需要伴生 VueLoaderPlugin的 解决方法: 在webpack.config.js中加入如下: var path=require('path'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); var ExtractTextPlugin=require('extract-text-webpack-plugin'); var config={ // 配置入口 entry:{ main:'./main' }, // 配置出口 output:{ // path用来存放打包后的文件输出目录,必填 path:path.join(__dirname,'./dist'), // publicPath指定资源文件引用的目录 publicPath:'/dist/', // filename用于指定输出文件的名称 filename:'main.js' }, // 配置Loader,增加对.css文件的处理

vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.

こ雲淡風輕ζ 提交于 2019-12-05 01:04:21
默认,webpack无法打包.vue文件,需要安装 相关的loader: cnpm i vue-loader vue-template-compiler -D 提示以下错误信息: Module Error (from ./node_modules/_vue-loader@15.7.2@vue-loader/lib/index.js): vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. 解决办法: 参考博客: https://blog.csdn.net/cominglately/article/details/80555210 完美解决 来源: https://www.cnblogs.com/songsongblue/p/11893924.html

Does import create a new copy of imported library?

女生的网名这么多〃 提交于 2019-12-04 09:18:50
I'm using webpack + vue-loader to create vuejs app. I have multiple .vue files for components. When I write something like this: import _ from 'lodash' inside the script part of ComponentA.vue and ComponentB.vue , does this create two separate copies of lodash or does it simply import a reference? Importing an ES6 module, or any part of an ES6 module, produces a binding . CommonJS modules export values, while ES6 modules export immutable bindings . This blog post explains what that means. [ Source: ES6 Module Exports ] So the answer is no, it does not create a copy of the exports. The module

How can I get vue-loader to interpolate asset urls?

﹥>﹥吖頭↗ 提交于 2019-12-04 01:46:32
问题 I have an image with a dynamic (interpolated) src attribute. <img src="./{{bar}}.jpg"/> How do I get vue-loader to interpolate {{bar}} ? 回答1: I'm pretty sure that your code throws a warning (not referred it): [Vue warn]: src="./{{bar}}.jpg": interpolation in "src" attribute will cause a 404 request. Use v-bind:src instead. So, you should bind the value: <img :src="'/assets/' + bar + '.jpg'"> The above example it loads an image xxx.jpg from the static directory assets , but not via loader yet.

vue-loader@15.x VueLoaderPlugin 记录一下

♀尐吖头ヾ 提交于 2019-12-03 21:52:38
报错:==vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.== 目前, //两个方式都可以的,随便用一个 const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' ); // 或者 const { VueLoaderPlugin } = require ( 'vue-loader' ) plugins: [ // make sure to include the plugin for the magic new VueLoaderPlugin() ] 问题描述: 基本上,加上这样上面这些都是没问题的。但还是会报错,原因在于下面这段代码, 可以看到,加入了 resolveLoader 之后,所有 rules 下的 loader 配置都没有直接跟随后缀 -loader ,导致一直再报各种各样的错误信息! module : { rules : [{ test: /\.js$/, loader: 'babel' , }, { test : /\.vue$/, loader: 'vue' , }, { test : /\.(css|less)$/,

【原创】从零开始搭建Electron+Vue+Webpack项目框架,一套代码,同时构建客户端、web端(二)

柔情痞子 提交于 2019-12-03 13:48:40
摘要 : 上篇文章说到了如何新建工程,并启动一个最简单的Electron应用。“跑起来”了Electron,那就接着把Vue“跑起来”吧。有一点需要说明的是,webpack是贯穿这个系列始终的,我也是本着学习的态度,去介绍、总结一些常用到的配置及思路,有不恰当的地方,或者待优化的地方,欢迎留言。项目完整代码: https://github.com/luohao8023/electron-vue-template 下面开始~~~ 一、安装依赖 vue、webpack:不多说了 vue-loader:解析、转换.vue文件 vue-template-compiler:vue-loader的依赖包,但又独立于vue-loader,简单的说,作用就是使用这个插件将template语法转为render函数 webpack-dev-server:快速搭建本地运行环境的工具 webpack-hot-middleware:搭配webpack-dev-server使用,实现热更新 chalk:命令行输出带有颜色的内容 依赖包就介绍这么多,后面需要什么可以自行下载,这里不多赘述了。 二、完善工程目录    webpack.render.config.js:渲染进程打包配置 dev.js:本地调试脚本 views:页面代码 index.js:vue工程入口文件 index.ejs