Skip to content

Commit

Permalink
fix(moment): rollup compile with incorrect sourcemap (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinboLen authored and vthinkxie committed Sep 22, 2017
1 parent 1220c9d commit aec9f83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"protractor": "~5.1.2",
"rollup": "^0.49.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^2.0.0",
"rxjs": "^5.0.1",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
Expand Down
17 changes: 2 additions & 15 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import resolve from 'rollup-plugin-node-resolve'
import replace from 'rollup-plugin-replace'

const format = process.env.ROLLUP_FORMAT || 'es'

Expand Down Expand Up @@ -43,20 +44,6 @@ if (format === 'es') {
})
}

function fixMoment() {
return {
name: 'fix-moment-import',
transform(content) {
if (!content.includes(`import * as moment from 'moment'`)) { return }

return content.replace(
`import * as moment from 'moment'`,
`import moment from 'moment'`
)
},
}
}

let input
let file

Expand All @@ -81,7 +68,7 @@ export default {
},
exports: 'named',
name: 'ngZorro.antd',
plugins: [fixMoment(), resolve()],
plugins: [replace({ "import * as moment": "import moment" }), resolve()],
external: Object.keys(globals),
globals,
}

0 comments on commit aec9f83

Please sign in to comment.