Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/build/babel/plugins/handle-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// We've added support for SSR with this version
import template from 'babel-template'
import syntax from 'babel-plugin-syntax-dynamic-import'
import { dirname, resolve } from 'path'
import { dirname, resolve, sep } from 'path'
import Crypto from 'crypto'

const TYPE_IMPORT = 'Import'
Expand Down Expand Up @@ -62,8 +62,8 @@ export default () => ({
const modulePath = getModulePath(sourceFilename, moduleName)
const modulePathHash = Crypto.createHash('md5').update(modulePath).digest('hex')

const relativeModulePath = modulePath.replace(process.cwd(), '')
const name = `${relativeModulePath.replace(/[^\w]/g, '-')}-${modulePathHash}`
const relativeModulePath = modulePath.replace(`${process.cwd()}${sep}`, '')
const name = `${relativeModulePath.replace(/[^\w]/g, '_')}_${modulePathHash}`

const newImport = buildImport({
name
Expand Down