The modern property
Build and serve a modern bundle
This feature is inspired by vue-cli modern mode
- 
Type: 
StringorBoolean- Default: false
 - 
Possible values:
- 
'client': Serve both, the modern bundle<script type="module">and the legacy bundle<script nomodule>scripts, also provide a<link rel="modulepreload">for the modern bundle. Every browser that understands themoduletype will load the modern bundle while older browsers fall back to the legacy (transpiled) one. - 
'server'ortrue: The Node.js server will check browser version based on the user agent and serve the corresponding modern or legacy bundle. - 
false: Disable modern build 
 - 
 
 
The two versions of bundles are:
- Modern bundle: targeting modern browsers that support ES modules
 - Legacy bundle: targeting older browsers based on babel config (IE9 compatible by default).
 
Info:
- 
Use command option 
[--modern | -m]=[mode]to build/start modern bundles: 
package.json
{
  "scripts": {
    "build:modern": "nuxt build --modern=server",
    "start:modern": "nuxt start --modern=server"
  }
}
 Note about nuxt generate: The modern property also works with the nuxt generate command, but in this case only the client option is honored and will be selected automatically when launching the nuxt generate --modern command without providing any values.
- 
Nuxt will automatically detect 
modernbuild innuxt startwhenmodernis not specified, auto-detected mode is: 
| ssr | Modern Mode | 
|---|---|
| true | server | 
| false | client | 
- 
Modern mode for 
nuxt generatecan only beclient - 
Use 
render.crossoriginto setcrossoriginattribute in<link>and<script> 
Please refer Phillip Walton's excellent post for more knowledge regarding modern builds.
 
        Edit this page on GitHub
        
      Updated at Wed, Apr 19, 2023
    
 
 
        N3-rd
       
 
        Adrien Zaganelli
       
 
        Mag
       
 
        Stefan Huber
       
 
        Olga Bulat
       
 
        Maciek Palmowski
       
 
        Sébastien Chopin
       
 
        Daniel Roe
       
 
        Clément Ollivier
       
 
        Paiva
       
 
        Florian Reuschel
       
 
        Rishi Raj Jain
       
 
        Savas Vedova
       
 
        Steven Soekha
       
 
        Vinícius Alves
       
 
        Kareem Dabbeet
       
 
        Valentín Costa
       
 
        Ryan Skinner
       
 
        Alex Hirzel
       
 
        Ajeet Chaulagain
       
 
        René Eschke
       
 
        Nico Devs
       
 
        Muhammad
       
 
        Nazaré da Piedade
       
 
        Naoki Hamada
       
 
        Tom
       
 
        Yann Aufray
       
 
        Anthony Chu
       
 
        Nuzhat Minhaz
       
 
        Lucas Portet
       
 
        Richard Schloss
       
 
        bpy
       
 
        Antony Konstantinidis
       
 
        Hibariya
       
 
        Jose Seabra
       
 
        Eze
       
 
        Florian LEFEBVRE
       
 
        Lucas Recoaro
       
 
        Julien SEIXAS
       
 
        Hugo
       
 
        Sylvain Marroufin
       
 
        Spencer Cooley
       
 
        Piotr Zatorski
       
 
        Vladimir Semyonov
       
 
        Harry Allen
       
 
        kazuya kawaguchi
       
 
        Unai Mengual
       
 
        Hyunseung
       
 
        Alexandre Chopin
       
 
        pooya parsa
       
 
        Nick Medrano
       
 
        Mosaab Emam
       
 
        Ilja
       
 
        Heitor Ramon Ribeiro
       
 
        Nero
       
 
        Yoon Han