dynamically import not working when build
See original GitHub issue@jpkleemans Hi, I used this but failed when build for production. It’s working in dev mode
<script lang="ts">
import { computed, defineComponent, defineAsyncComponent } from 'vue'
export default defineComponent({
props: {
name: {
type: String,
default: undefined,
},
},
setup(props) {
const currentIcon = computed(() => defineAsyncComponent(() => import(`../../icons/${props.name}.svg?component`))).value
return {
currentIcon
}
}
})
</script>
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:13 (3 by maintainers)
Top Results From Across the Web
[SOLVED] - Dynamic import not working - help - Meteor.js forums
Hey there! I'm trying to implement dynamic loading to split the code per page to minimise the main bundle size cause the app...
Read more >Dynamic imports not working on built project - only on the dev ...
When I run parcel build index.html (build static files for browser) the dynamic imports are not working. This is the dynamic import I...
Read more >import() in ts is not dynamic? what's the cause? - Stack Overflow
"dynamic" means you can do import("someFile" + someVariable) which you cannot do with a regular import statement. It's static, thus it would not...
Read more >Advanced Features: Dynamic Import - Next.js
Dynamically import JavaScript modules and React Components and split your code into manageable chunks.
Read more >Dynamic imports and code splitting with Next.js
Dynamic imports, also known as code splitting, refers to the practice of dividing bundles of JavaScript code into smaller chunks, which are then ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
U welcome https://stackblitz.com/edit/github-1ck5ek?file=app.vue 😃
Resolve this problem, create a functional component: