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.

globalName, globals and publicPath settings have no effect

See original GitHub issue

Environment

Nuxt CLI v3.0.0-27243104.5e903ae 16:12:01 RootDir: /Users/stewan/dev/stewan-nuxt 16:12:02 Nuxt project info: 16:12:02


  • Operating System: Darwin
  • Node Version: v14.17.6
  • Nuxt Version: 3.0.0-27243104.5e903ae
  • Package Manager: npm
  • Bundler: Vite
  • User Config: css, build
  • Runtime Modules: -
  • Build Modules: -

Describe the bug

globalName, globals and publicPath settings have no effect

Reproduction

I followed the basic setup for nuxt3 on docs

and tried this config

import { defineNuxtConfig } from "nuxt3";

export default defineNuxtConfig({
  globalName: "__stew",
  globals: {
    id: () => `__stew`,
  },
  css: ["~/assets/css/tailwind.css"],
  build: {
    publicPath: "stew/",
    postcss: {
      postcssOptions: {
        plugins: {
          tailwindcss: {},
          autoprefixer: {},
        },
      },
    },
  },
});

nothing works when building for production. in dev publicPath sometimes work, sometimes not

Additional context

No response

Logs

No response

Issue Analytics

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

github_iconTop GitHub Comments

15reactions
stewonescommented, Oct 20, 2021

@stewones Why would you need to customize __nuxt id?

For the same reason as publicPath, white labeling. Depending on the project, it’s important to hide the tech stack behind the scenes.

13reactions
coryvirokcommented, Nov 24, 2021

I’m expecting that something like the globalName will be added back in once Nuxt3 goes GA. There were a ton of requests for it due to what @stewones mentioned. My 2 primary needs for it are related to hiding the tech stack and changing the CSS for the <body><div id="__nuxt"> element. Without being able to change the global name for that element, Nuxt users will need to add CSS to their global styles that reference a DOM id that is hidden, (read: not configurable or documented) and could change at any time.

I suppose a partial solution for me would be if we could change the attrs for that element via the meta composable, like we do for head and body. But that still leaves the tech-stack obfuscation issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure webpack publicPath setting has no effect
I have setup a dev server running, meteor, react, webpack. When I load up the site located here: vps.elemental.co.za:3000 all starts off OK ......
Read more >
API - esbuild
Banner; Charset; Color; Drop; Footer; Global name; Ignore annotations; JSX; JSX dev ... Note that this setting only has an effect when bundling...
Read more >
The build Property - Nuxt
Nuxt lets you customize the webpack configuration for building your web application as you want.
Read more >
rollup.js
Rollup configuration files are optional, but they are powerful and convenient and thus recommended. A config file is an ES module that exports...
Read more >
Public Path - webpack
The publicPath configuration option can be quite useful in a variety of ... In development for example, we might have an assets/ folder...
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