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

fix: module rewrite in unoptimized dep #344

Merged
merged 9 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: add test case for normalizePublicPath and watch it fail
  • Loading branch information
csr632 committed Jun 4, 2020
commit 355ebb2162b114c6078f28f9a44b67777fd2cae1
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"ws": "^7.2.3"
},
"devDependencies": {
"@babel/runtime": "7.10.2",
"@pika/react": "^16.13.1",
"@pika/react-dom": "^16.13.1",
"@types/es-module-lexer": "^0.3.0",
Expand Down
5 changes: 4 additions & 1 deletion playground/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<TestCustomBlocks />
<TestOptimizeLink />
<TestRewriteUnoptimized />
<TestNormalizePublicPath />
</template>

<script>
Expand All @@ -50,6 +51,7 @@ import TestCssAtImport from './css-@import/TestCssAtImport.vue'
import TestCustomBlocks from './custom-blocks/TestCustomBlocks.vue'
import TestOptimizeLink from './optimize-linked/TestOptimizeLink.vue'
import TestRewriteUnoptimized from './rewrite-unoptimized/TestRewriteUnoptimized.vue'
import TestNormalizePublicPath from './TestNormalizePublicPath.vue'

export default {
data: () => ({
Expand All @@ -76,7 +78,8 @@ export default {
TestRewriteOptimized,
TestCustomBlocks,
TestOptimizeLink,
TestRewriteUnoptimized
TestRewriteUnoptimized,
TestNormalizePublicPath
}
}
</script>
21 changes: 21 additions & 0 deletions playground/TestNormalizePublicPath.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<h2>TestNormalizePublicPath</h2>
<p class="normalize-public-path">{{ msg }}</p>
</template>

<script>
import slicedToArray from '@babel/runtime/helpers/esm/slicedToArray'

const iterable = (function* () {
yield 2
yield 4
yield 6
yield 8
})()

export default {
data: () => ({
msg: JSON.stringify(slicedToArray(iterable, 2))
})
}
</script>
1 change: 1 addition & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"bootstrap": "link:../node_modules/bootstrap",
"lodash-es": "link:../node_modules/lodash-es",
"moment": "link:../node_modules/moment",
"@babel/runtime": "link:../node_modules/@babel/runtime",
"normalize.css": "link:../node_modules/normalize.css",
"resolve-browser-field-test-package": "link:./resolve-browser-field",
"rewrite-optimized-test-package": "link:./rewrite-optimized/test-package",
Expand Down
9 changes: 9 additions & 0 deletions playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# yarn lockfile v1


"@babel/runtime@link:../node_modules/@babel/runtime":
version "0.0.0"
uid ""

"bootstrap@link:../node_modules/bootstrap":
version "0.0.0"
uid ""
Expand All @@ -26,6 +30,11 @@
version "0.0.0"
uid ""

regenerator-runtime@^0.13.4:
version "0.13.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"
integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==

"resolve-browser-field-test-package@link:./resolve-browser-field":
version "0.0.0"
uid ""
Expand Down
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ describe('vite', () => {
await expectByPolling(() => getText('.custom-block'), 'こんにちは')
}
})

test('normalize publicPath', async () => {
expect(await getText('.normalize-public-path')).toMatch(
JSON.stringify([2, 4])
)
})
}

// test build first since we are going to edit the fixtures when testing dev
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/runtime@7.10.2":
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.2.tgz#d103f21f2602497d38348a32e008637d506db839"
integrity sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.9.2":
version "7.9.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.6.tgz#a9102eb5cadedf3f31d08a9ecf294af7827ea29f"
Expand Down