mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(webpack): exclude assets from webpack externals (#471)
This commit is contained in:
parent
193d7bf8bc
commit
8aaa1b3124
@ -4,6 +4,8 @@ import { WebpackConfigContext, applyPresets, getWebpackConfig } from '../utils/c
|
|||||||
import { nuxt } from '../presets/nuxt'
|
import { nuxt } from '../presets/nuxt'
|
||||||
import { node } from '../presets/node'
|
import { node } from '../presets/node'
|
||||||
|
|
||||||
|
const assetPattern = /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(\?.*)?$/i
|
||||||
|
|
||||||
export function server (ctx: WebpackConfigContext) {
|
export function server (ctx: WebpackConfigContext) {
|
||||||
ctx.name = 'server'
|
ctx.name = 'server'
|
||||||
ctx.isServer = true
|
ctx.isServer = true
|
||||||
@ -50,7 +52,8 @@ function serverStandalone (ctx: WebpackConfigContext) {
|
|||||||
if (
|
if (
|
||||||
request[0] === '.' ||
|
request[0] === '.' ||
|
||||||
isAbsolute(request) ||
|
isAbsolute(request) ||
|
||||||
inline.find(prefix => request.startsWith(prefix))
|
inline.find(prefix => request.startsWith(prefix)) ||
|
||||||
|
assetPattern.test(request)
|
||||||
) {
|
) {
|
||||||
// console.log('Inline', request)
|
// console.log('Inline', request)
|
||||||
return cb(null, false)
|
return cb(null, false)
|
||||||
|
1
playground/assets/logo.svg
Normal file
1
playground/assets/logo.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg width="218" height="43" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M76.098 10.302h6.404l13.573 22.136V10.302h5.911v31.365h-6.36l-13.617-22.09v22.09h-5.911V10.302zM128.411 41.668h-5.509v-3.504c-1.254 2.466-3.806 3.854-7.03 3.854-5.107 0-8.423-3.674-8.423-8.963V19.083h5.509v12.816c0 3.092 1.883 5.242 4.704 5.242 3.091 0 5.24-2.42 5.24-5.734V19.083h5.509v22.585zM147.583 41.668l-5.285-7.529-5.286 7.529h-5.868l8.153-11.785-7.525-10.8h6.001l4.525 6.499 4.478-6.5h6.047l-7.571 10.8 8.154 11.786h-5.823zM164.602 12.273v6.81h6.271v4.616h-6.271v11.21a1.42 1.42 0 001.418 1.422h4.853v5.328h-3.629c-4.927 0-8.151-2.869-8.151-7.883V23.703h-4.435v-4.62h2.782c1.298 0 2.053-.773 2.053-2.052v-4.758h5.109zM184.761 34.564V10.302h5.909v22.403c0 6.05-2.911 8.962-7.838 8.962h-6.879V36.34h7.033a1.776 1.776 0 001.775-1.776zM194.211 31.137h5.691c.315 3.504 2.644 5.735 6.406 5.735 3.36 0 5.691-1.342 5.691-4.121 0-6.723-16.853-2.063-16.853-14.071.004-5.153 4.438-8.733 10.81-8.733 6.63 0 11.108 3.808 11.382 9.679h-5.661c-.267-2.733-2.407-4.57-5.732-4.57-3.091 0-5.017 1.434-5.017 3.628 0 6.946 17.073 1.752 17.073 13.981 0 5.825-4.794 9.366-11.691 9.366-7.122 0-11.78-4.303-12.093-10.89" fill="#003543"/><path d="M33.893 41.626h22.459a4.062 4.062 0 003.517-6.098L44.786 9.39a4.063 4.063 0 00-7.037 0l-3.856 6.687-7.54-13.077a4.066 4.066 0 00-7.04 0L.545 35.528a4.065 4.065 0 003.517 6.098H18.16c5.586 0 9.705-2.455 12.54-7.244l6.88-11.923 3.687-6.38 11.062 19.166H37.58l-3.688 6.381zM17.93 35.239l-9.839-.003L22.84 9.682 30.2 22.46 25.27 31c-1.882 3.107-4.02 4.24-7.341 4.24z" fill="#00DC82"/></svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<img src="~/assets/logo.svg">
|
||||||
Hello World
|
Hello World
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user