Commit a730b04d authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

Use _ as the divider for dynamic import name splitter. (#2793)

Using - gives us some weird webpack errors.
parent eafa2c67
...@@ -2,7 +2,7 @@ ...@@ -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 () => ({ ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment