This repository was archived by the owner on Dec 1, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Dec 1, 2020. It is now read-only.
rollup replace configure seems to not working #41
Copy link
Copy link
Open
Description
In vue.config.js, I set up rollup-plugin-replace option, but replacement dosen't work.
vue.config.js
const replace = require('rollup-plugin-replace')
module.exports = {
pluginOptions: {
p11n: {
configureRollup: {
plugins: [ replace({ imgpath: "'../src/assets/logo.png'"}) ]
}
}
}
}
input(src/components/HelloWorld.vue)
<template>
<div class="hello">
<img v-bind:src="img">
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
},
data: function(){
return {
img: require(imgpath)
}
}
}
</script>
output(p11ntest.esm.js)
var script = {
name: 'HelloWorld',
props: {
msg: String
},
data: function data() {
return {
img: require(imgpath) <- expected "require('../src/assets/logo.png')"
};
}
};
(for entire test project, view my repository. https://github.com/fifzteen/p11ntest/tree/master)
I also test to rollup directly. that is working correctly.
rollup.config.js
import path from 'path'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import vue from 'rollup-plugin-vue'
import replace from 'rollup-plugin-replace'
export default [{
input: path.join(__dirname, '.', 'src', 'components', 'HelloWorld.vue'),
output: [
{
file: 'dist/p11ntest_rollup.esm.js',
format: 'es'
}
],
plugins: [
vue({css: true}),
replace({
imgpath: "'../src/assets/logo.png'"
}),
commonjs(),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
}),
]
}]
output(p11ntest_rollup.sem.js)
var script = {
name: 'HelloWorld',
props: {
msg: String
},
data: function data() {
return {
img: require('../src/assets/logo.png')
};
}
};
I'm happy to tell me solutions or whether this is a bug or not.
Metadata
Metadata
Assignees
Labels
No labels