-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add rollup & multitarget support #11
base: master
Are you sure you want to change the base?
Add rollup & multitarget support #11
Conversation
@@ -21,7 +23,7 @@ function getCmdOptions (cmd: any) { | |||
} | |||
|
|||
program | |||
.version(require('../../package.json').version) | |||
.version(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version is wrong on release.
Because bundling is before upgrading package.json
version.
tsconfig: 'tsconfig.compile.json' | ||
}) | ||
const pluginJson = json() | ||
const pluginCommonJs = commonjs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pluginCommonJs
is needed when any output.
Because it is converting CommonJS modules to ES6 for dependencies
file: 'dist/index.browser.mjs', | ||
format: 'es' | ||
}, | ||
plugins: [replace({ 'process.env.BROWSER': 'true' }), pluginJson, pluginTypeScript] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can replace process.env.BROWSER
to __BROWSER__
.
const isNode = typeof window === 'undefined' | ||
if (!isNode) { | ||
if (process.env.BROWSER || !isNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need isNode
.
@@ -1 +1,4 @@ | |||
declare module 'prettier-eslint' | |||
declare module 'prettier-eslint' { | |||
const ret: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why about this code?
if (isVueFile(fileFsPath)) { | ||
const scriptContent = parseVueFile(options.vueTemplateCompiler, fileContent).script | ||
if (scriptContent) { | ||
log(`Readed Vue file: ${fileFsPath}`) | ||
if (scriptContent?.content != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does we need != null
?
@@ -0,0 +1,46 @@ | |||
import commonjs from '@rollup/plugin-commonjs' | |||
import json from '@rollup/plugin-json' | |||
import replace from '@rollup/plugin-replace' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add replace({ 'process.env.BROWSER': 'false' })
for outputs without browser.
Thanks for contribution. |
@@ -9,7 +9,7 @@ export interface Vc2cOptions { | |||
compatible: boolean | |||
setupPropsKey: string | |||
setupContextKey: string | |||
typesciprt: typeof ts | |||
typescript: typeof ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for fixing typo.
This project is use this commit message style. |
Now we that we used rollup we can pack this in webpack at a much faster speed
Fixes #10