mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Use _ as the divider for dynamic import name splitter. (#2793)
Using - gives us some weird webpack errors.
This commit is contained in:
parent
eafa2c676d
commit
a730b04df7
|
@ -2,7 +2,7 @@
|
||||||
// We've added support for SSR with this version
|
// We've added support for SSR with this version
|
||||||
import template from 'babel-template'
|
import template from 'babel-template'
|
||||||
import syntax from 'babel-plugin-syntax-dynamic-import'
|
import syntax from 'babel-plugin-syntax-dynamic-import'
|
||||||
import { dirname, resolve } from 'path'
|
import { dirname, resolve, sep } from 'path'
|
||||||
import Crypto from 'crypto'
|
import Crypto from 'crypto'
|
||||||
|
|
||||||
const TYPE_IMPORT = 'Import'
|
const TYPE_IMPORT = 'Import'
|
||||||
|
@ -62,8 +62,8 @@ export default () => ({
|
||||||
const modulePath = getModulePath(sourceFilename, moduleName)
|
const modulePath = getModulePath(sourceFilename, moduleName)
|
||||||
const modulePathHash = Crypto.createHash('md5').update(modulePath).digest('hex')
|
const modulePathHash = Crypto.createHash('md5').update(modulePath).digest('hex')
|
||||||
|
|
||||||
const relativeModulePath = modulePath.replace(process.cwd(), '')
|
const relativeModulePath = modulePath.replace(`${process.cwd()}${sep}`, '')
|
||||||
const name = `${relativeModulePath.replace(/[^\w]/g, '-')}-${modulePathHash}`
|
const name = `${relativeModulePath.replace(/[^\w]/g, '_')}_${modulePathHash}`
|
||||||
|
|
||||||
const newImport = buildImport({
|
const newImport = buildImport({
|
||||||
name
|
name
|
||||||
|
|
Loading…
Reference in a new issue