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

Including assets inside vue-components #6

Open
JohnnyCrazy opened this issue Sep 26, 2017 · 1 comment
Open

Including assets inside vue-components #6

JohnnyCrazy opened this issue Sep 26, 2017 · 1 comment

Comments

@JohnnyCrazy
Copy link

JohnnyCrazy commented Sep 26, 2017

When using assets like png, svg, or jpeg they won't be included in the final package. Is there any way to get around this?

Example:

A.vue

<template>
  <div>
    <img :src="logo" />
  </div>
</template>
<script>
import logo from './logo.png'

export default {
  data() {
    return {
      logo: logo,
    };
  },
};
</script>

Output:

docs/img/logo.e25ad72.svg  12.8 kB          [emitted]  
lib/my_test.min.js  54.9 kB       0  [emitted]  my_test
lib/my_test.min.css  3.05 kB       0  [emitted]  my_test
lib/my_test.min.js.map   535 kB       0  [emitted]  my_test
lib/my_test.min.css.map   5.8 kB       0  [emitted]  my_test

@LiuJiangshan
Copy link

in build-lib.js

process.env.NODE_ENV = 'production'

change to

process.env.NODE_ENV = 'lib'

in webpack.lib.conf.js

module: {
    rules: utils.styleLoaders({
      sourceMap: config.lib.productionSourceMap,
      extract: true
    })
  }

change to

module: {
    rules: utils.styleLoaders({
      sourceMap: config.lib.productionSourceMap,
      extract: false
    })
  }

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

2 participants