-
Notifications
You must be signed in to change notification settings - Fork 333
chore: Migrated Vite to Rollup, Removed Vite related dependencies #6423
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
6ab49a6
b206bc4
029097a
cff5273
af871a8
a751e5d
0b5e3e1
16d4ee3
d5d6842
96d4b2a
966cab0
19c33b5
daf03b0
b026311
2952a87
c703b2e
d4e5d95
6b2a8ad
89d3db4
2b64ed6
8e831ff
829e883
933afee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { defineConfig } from 'rollup'; | ||
import { fileURLToPath } from 'url'; | ||
import path from 'path'; | ||
import vue from 'rollup-plugin-vue'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars'; | ||
import externals from 'rollup-plugin-node-externals'; | ||
import esbuild from 'rollup-plugin-esbuild'; | ||
import typescript2 from 'rollup-plugin-typescript2'; | ||
|
||
// ES Module equivalent for __dirname | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const resolvePath = (str) => path.resolve(__dirname, str); | ||
|
||
// common config settings | ||
const input = 'src/index.ts'; | ||
const sourceMap = true; | ||
const tsconfig = 'tsconfig.dist.json'; | ||
|
||
|
||
// External dependencies that shouldn't be bundled | ||
const external = [ | ||
'@aws-amplify/auth', | ||
'@aws-amplify/core', | ||
'@aws-amplify/core/internals/utils', | ||
'aws-amplify', | ||
'aws-amplify/auth', | ||
'aws-amplify/core', | ||
'aws-amplify/utils', | ||
'vue', | ||
'qrcode', | ||
'nanoid', | ||
'@vueuse/core', | ||
'@xstate/vue', | ||
'xstate' | ||
]; | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @type {import('rollup').OutputOptions} | ||
*/ | ||
const cjsOutput = { | ||
file: resolvePath('./dist/index.cjs'), | ||
format: 'cjs', | ||
exports: 'named', | ||
sourcemap: sourceMap, | ||
globals: { vue: 'Vue' } | ||
}; | ||
|
||
/** | ||
* @type {import('rollup').OutputOptions} | ||
*/ | ||
const esmOutput = { | ||
file: resolvePath('./dist/index.js'), | ||
format: 'es', | ||
exports: 'named', | ||
sourcemap: sourceMap | ||
}; | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Following React's approach with Vue-specific additions | ||
const config = defineConfig({ | ||
input: resolvePath(input), | ||
output: [cjsOutput, esmOutput], | ||
external, | ||
plugins: [ | ||
// Exclude test files and node_modules | ||
externals({ | ||
exclude: ['tslib'], | ||
}), | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
resolve({ | ||
extensions: ['.js', '.ts', '.vue'] | ||
}), | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
commonjs(), | ||
// Vue-specific plugins | ||
vue({ | ||
preprocessStyles: true, | ||
template: { | ||
isProduction: true | ||
} | ||
}), | ||
postcss({ | ||
extract: 'style.css', | ||
minimize: true, | ||
sourceMap: true | ||
}), | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Use typescript2 for proper declaration file generation | ||
typescript2({ | ||
check: false, | ||
tsconfig: resolvePath(tsconfig), | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
sourceMap: true, | ||
declaration: true, | ||
declarationMap: true, | ||
outDir: resolvePath('./dist'), | ||
declarationDir: resolvePath('./dist') | ||
}, | ||
exclude: [ | ||
"**/__tests__/**", | ||
"**/__mocks__/**", | ||
"**/*.spec.ts", | ||
"global-spec.ts", | ||
"node_modules" | ||
] | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}), | ||
// Use esbuild for faster JavaScript transpilation | ||
esbuild({ | ||
include: /\.[jt]sx?$/, | ||
exclude: /node_modules|__tests__|__mocks__/, | ||
sourceMap: true, | ||
target: 'es2015', | ||
tsconfig: resolvePath(tsconfig) | ||
}), | ||
dynamicImportVars | ||
] | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
export default config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,4 +100,4 @@ function onBlur(e: Event) { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,4 @@ const onBackToSignInClicked = (): void => { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,4 +107,4 @@ const onLostCodeClicked = (): void => { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,4 +90,4 @@ const onSkipClicked = (): void => { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,4 @@ const orText = computed(() => getOrText()); | |
:data-label="orText" | ||
/> | ||
</base-wrapper> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,4 +113,4 @@ function onBlur(e: Event) { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,4 @@ const onBackToSignInClicked = (): void => { | |
</base-wrapper> | ||
</base-form> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,4 +158,4 @@ const onBackToSignInClicked = (): void => { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,4 +109,4 @@ const onForgotPasswordClicked = (): void => { | |
</slot> | ||
</base-footer> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,4 +146,4 @@ const onSkipClicked = (): void => { | |
</base-form> | ||
</base-wrapper> | ||
</slot> | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "dist", | ||
"outDir": "dist", | ||
"sourceMap": true, | ||
"rootDir": "src" | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think these should be set in the rollup config to align with other packages? |
||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], | ||
"exclude": [ | ||
"__tests__", | ||
"__mocks__", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think we need either of these, am i missing something? |
||
"node_modules", | ||
"**/*.spec.ts", | ||
"**/__tests__/**", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think line 15 is covered by line 16? |
||
"global-spec.ts" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to exclude |
||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
{ | ||
"extends": "@aws-amplify/typescript-config/tsconfig.vue.json", | ||
"include": [ | ||
"__mocks__", | ||
"__tests__", | ||
"src/**/*", | ||
"types/**/*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think this directory exists? |
||
"*.d.ts", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to include all d.ts files? |
||
"*.ts", | ||
"src/**/*.ts", | ||
"src/**/*.tsx", | ||
"src/**/*.vue" | ||
"__tests__/**/*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other package tsconfigs don't require this line for type checking the entry point __tests__ dir, why is it necessary here? |
||
"global-spec.ts" | ||
], | ||
"exclude": ["node_modules"] | ||
} | ||
"compilerOptions": { | ||
"types": [ | ||
"node", | ||
"jest", | ||
"@testing-library/jest-dom" | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is setting |
||
"composite": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to set |
||
"rootDir": "." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to set |
||
} | ||
} |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.