Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

test(preserve-modules) #414

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions examples/preserve-modules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "preserve-modules",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "rollup -c"
},
"dependencies": {
"rollup": "^2.10.9",
"rollup-plugin-vue": "link:../.."
}
}
15 changes: 15 additions & 0 deletions examples/preserve-modules/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import VuePlugin from 'rollup-plugin-vue'

export default [
{
input: 'src/HelloWorld.vue',
output: {
file: 'dist/HelloWorld.js',
format: 'esm',
sourcemap: 'inline',
preserveModules: true,
},
plugins: [VuePlugin()],
external: ['vue'],
},
]
14 changes: 14 additions & 0 deletions examples/preserve-modules/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<hello-world name="World" />
</template>

<script>
import HelloWorld from './HelloWorld.vue'

export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
9 changes: 9 additions & 0 deletions examples/preserve-modules/src/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
export default {
props: ['name'],
}
</script>

<template>
<div>Hello {{ name }}!</div>
</template>
12 changes: 12 additions & 0 deletions test/core.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ describe('typescript', () => {
})
})

describe('preserve modules', () => {
let result!: RollupOutput

beforeAll(async () => {
result = await roll('preserve-modules')
})

it('should have modules', () => {
expect(Object.keys(result.output[0].modules).length).not.toEqual(0)
})
})

import Path from 'path'
async function roll(name: string) {
const configFile = `../examples/${name}/rollup.config.js`
Expand Down