mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Support for wasm (#5316)
* Set a default path for wasm modules * Added the mimetype "application/wasm" for wasm files * Upgrade write-file-webpack-plugin to 4.4.1 * Made dynamic(import()) in test to dynamic(() => import())
This commit is contained in:
parent
e994159e38
commit
b041fa4782
|
@ -26,6 +26,9 @@ function getDynamicImportBundles (manifest, moduleIds) {
|
|||
|
||||
const logger = console
|
||||
|
||||
// since send doesn't support wasm yet
|
||||
send.mime.define({ 'application/wasm': ['wasm'] })
|
||||
|
||||
export async function render (req, res, pathname, query, opts) {
|
||||
const html = await renderToHTML(req, res, pathname, query, opts)
|
||||
sendHTML(req, res, html, req.method, opts)
|
||||
|
|
|
@ -197,7 +197,8 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
|
|||
hotUpdateMainFilename: 'static/webpack/[hash].hot-update.json',
|
||||
// This saves chunks with the name given via `import()`
|
||||
chunkFilename: isServer ? `${dev ? '[name]' : '[name].[contenthash]'}.js` : `static/chunks/${dev ? '[name]' : '[name].[contenthash]'}.js`,
|
||||
strictModuleExceptionHandling: true
|
||||
strictModuleExceptionHandling: true,
|
||||
webassemblyModuleFilename: 'static/wasm/[modulehash].wasm'
|
||||
},
|
||||
performance: { hints: false },
|
||||
resolve: resolveConfig,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Link from 'next/link'
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
const DynamicComponent = dynamic(import('../components/hello'))
|
||||
const DynamicComponent = dynamic(() => import('../components/hello'))
|
||||
|
||||
export default () => (
|
||||
<div id='dynamic-imports-page'>
|
||||
|
|
Loading…
Reference in a new issue