1
0
Fork 0
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:
Andy 2018-10-02 13:10:07 +02:00 committed by Tim Neutkens
parent e994159e38
commit b041fa4782
3 changed files with 6 additions and 2 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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'>