Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The webpack-simple template is not processing video tag or mp4 file #167

Open
leonardojobim opened this issue Jan 8, 2018 · 2 comments
Open

Comments

@leonardojobim
Copy link

The webpack-simple template is not processing the tag below:

<video poster="../../assets/videos/explore.jpg" preload="auto" autoplay muted style="width: 1155px; height: 650px; top: -153px; left: 29.8387px;">
  <source src="../../assets/videos/explore.mp4" type="video/mp4">
  <source src="../../assets/videos/explore.webm" type="video/webm">
</video>

It shows the message:
./src/assets/videos/explore.mp4
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.

The solution of @Zhangdroid below looks to work, but I don't know how to apply it to webpack 2.
vuejs-templates/webpack#277

Regards,

@guillecro
Copy link

Same here, when i build my webpack-simple project the urls are not being transformed like the other urls..

@wuyuedefeng
Copy link

wuyuedefeng commented Feb 14, 2018

you can try to edit
build/vue-loader.conf.js

module.exports = {
  loaders: utils.cssLoaders({
    sourceMap: isProduction
      ? config.build.productionSourceMap
      : config.dev.cssSourceMap,
    extract: isProduction,
    postcss: [require('postcss-cssnext')()]
  }),
 // add this line
  transformToRequire: {
    video: 'src',
    source: 'src',
    img: 'src',
    image: 'xlink:href'
  }
}

build/webpack.base.conf.js
add below code

   {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
    }

it can solve my problem same with you, hope can help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants