question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

provide baseUrl for development mode

See original GitHub issue

What problem does this feature solve?

baseUrl in vue.config.js now only works in production mode. In my case, I need to load the page as an iframe.

something like

<!-- http://localhost/ -->
<body>
<iframe src="http://localhost/myframe/"></iframe>
</body>

But it turns out http://localhost/myframe/ will load app.js from http://localhost/ which is not right.

PS. I need to inject some data into iframe, so it needed to be run in development mode for debugging

What does the proposed API look like?

maybe a devBaseUrl

module.exports = {
  baseUrl: '/myframe/', // this works in production mode
  devBaseUrl: '/myframe/' // this works in development mode
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
troy351commented, Apr 16, 2018

@duduluu you may misunderstood my question. the problem is that embed spa getting its app.js from main spa for there is a / before it. So the embed spa won’t render correctly.

The main spa finding embed spa thing works fine with nginx

1reaction
duduluucommented, Apr 13, 2018

Not sure your frame is a static page or vue app.

If it’s a static page, you could set dev server in vue.config.js like this:

const express = require('express');

module.exports = {
  devServer: {
    proxy: null, // string | Object
    before: app => {
      // the app is the instance of the express app
      app.use('/myframe', express.static('path/to/myframe'));
    },
  },
};

If vue app, set the base for vue router in router.js, Vue router documents base

import Vue from 'vue';
import Router from 'vue-router';
import Home from './views/Home.vue';
import About from './views/About.vue';

Vue.use(Router);

export default new Router({
  mode: 'history',
  base: '/myframe/',
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
    },
    {
      path: '/about',
      name: 'about',
      component: About,
    },
  ],
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt How to set baseURL in dev or production - Stack Overflow
This is the way to do it through the nuxt.config.js : let development = process.env.NODE_ENV !== 'production' module.exports = { axios: ...
Read more >
Set HTTP Base URLs of Production and Development ...
In this lesson you can learn how to set http base url for production and development environment in angular 6 or angular 7....
Read more >
How to handle environment-specific settings in your ...
Simple. Just host the app and API from the same webserver, so relative URLs work everywhere. This avoids both the base URL issue...
Read more >
Configuration Reference | Vue CLI
Vue CLI is in Maintenance Mode! For new projects, it is now recommended to use create-vue to scaffold Vite-based projects.
Read more >
Set up a Development URL (with TypeScript) - App development
By providing a Development URL, you can make changes to an extension and see the results of those changes by ... const libUrl...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found