vue webpack 安装raw-loader支持

2020-03-04 12:56:59

参考连接 https://www.webpackjs.com/loaders/raw-loader/

raw-loader

查看原文|查看仓库|编辑此页

A loader for webpack that lets you import files as a string.

安装

npm install --save-dev raw-loader

用法

通过 webpack 配置、命令行或者内联使用 loader。

##

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/,
        use: 'raw-loader'
      }
    ]
  }}

在你的项目中

import txt from './file.txt';

通过命令行(CLI)

webpack --module-bind 'txt=raw-loader'

在你的项目中

import txt from 'file.txt';

内联使用

在你的项目中

import txt from 'raw-loader!./file.txt';

维护者


  • 2020-12-21 09:42:42

    iframe.contentWindow 操作iframe

    注:iframe.contentWindow这里,返回的是iframe的window对象,所以后面可以接着调用document方法,再接着调用getElementByTagName。那么就可以对iframe里面的元素进行操作了。

  • 2020-12-21 14:00:19

    iframe + postMessage跨域通信

    在实际项目开发中可能会碰到在 a.com 页面中嵌套 b.com 页面,这时第一反应是使用 iframe,但是产品又提出在 a.com 中操作,b.com 中进行显示,或者相反。

  • 2020-12-22 12:02:41

    ios开发优秀的开源框架,demo集合

    期待大家和我们一起共同维护,同时也期望大家随时能提出宝贵的意见(直接提交issues即可)。请广大网友只按照目录结构(即使目录结构有问题)添加三方库,并提交pull request。目录问题大家提出issues后楼主会及时更改的。