Skip to content

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6ab49a6
chore: Migrated Vite to Rollup, Removed Vite related dependencies
yuhengshs Mar 10, 2025
b206bc4
changed global-spec back to ./src
yuhengshs Mar 10, 2025
029097a
Aligned with already existed configs from other packages. Removed exc…
yuhengshs Mar 18, 2025
cff5273
fix Unable to resolve
yuhengshs Mar 18, 2025
af871a8
Added role=textbox in base-input.vue
yuhengshs Mar 19, 2025
a751e5d
Fix password control component and update base-input with dynamic role
yuhengshs Mar 19, 2025
0b5e3e1
update base-input.vue
yuhengshs Mar 19, 2025
16d4ee3
cleaned up and make e2e tests workable
yuhengshs Mar 27, 2025
d5d6842
cleaned up unneccesary add ons
yuhengshs Mar 27, 2025
96d4b2a
update yarn.lock file
yuhengshs Mar 27, 2025
966cab0
resolved conflicts in these 2 files
yuhengshs Mar 27, 2025
19c33b5
updated dependecy files
yuhengshs Mar 27, 2025
daf03b0
resolved merge conflicts
yuhengshs Mar 27, 2025
b026311
updated snapshots
yuhengshs Mar 27, 2025
2952a87
fixed lint issue
yuhengshs Mar 27, 2025
c703b2e
cleaned up rollup configs under vue
yuhengshs Mar 28, 2025
d4e5d95
cleaned up rollup configs under vue
yuhengshs Mar 28, 2025
6b2a8ad
removed excessive exports and corrected dependencies
yuhengshs May 22, 2025
89d3db4
resolved merge conflict
yuhengshs May 22, 2025
2b64ed6
updated dependencies
yuhengshs May 22, 2025
8e831ff
Merge branch 'main' into chore/migrate-vite-to-rollup
yuhengshs May 22, 2025
829e883
update snapshot test
yuhengshs May 22, 2025
933afee
solved dependencies issues
yuhengshs May 23, 2025
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: 5 additions & 1 deletion packages/vue/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ const config: Config = {
moduleNameMapper: {
'\\.css$': '<rootDir>/__mocks__/styleMock.js',
'^nanoid$': '<rootDir>/../../node_modules/nanoid',
'^@/(.*)$': '<rootDir>/src/$1',
'^./src/components/(.*)$': '<rootDir>/src/components/$1',
},
modulePathIgnorePatterns: ['<rootDir>/dist/'],
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/.rollup.cache/'],
setupFilesAfterEnv: ['./jest.setup.ts'],
transform: {
'^.+\\.(ts)$': 'ts-jest',
Expand All @@ -38,6 +40,8 @@ const config: Config = {
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
roots: ['<rootDir>/src', '<rootDir>/__tests__'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?|vue)$',
};

export default config;
20 changes: 15 additions & 5 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
],
"scripts": {
"prebuild": "rimraf dist",
"build": "vite build",
"dev": "vite build --watch",
"build": "rollup -c",
"dev": "rollup -c -w",
"clean": "rimraf dist node_modules",
"check:esm": "node --input-type=module --eval 'import \"@aws-amplify/ui-vue\"'",
"lint": "yarn typecheck && eslint . --ext .vue,.js,.jsx,.ts,.tsx",
Expand All @@ -48,21 +48,31 @@
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^28.0.3",
"@rollup/plugin-dynamic-import-vars": "^1.4.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@rushstack/eslint-patch": "^1.5.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/vue": "^6.6.0",
"@types/node": "18.8.0",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/babel-plugin-jsx": "^1.2.2",
"@vue/compiler-sfc": "^3.3.4",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/test-utils": "^2.4.1",
"@vue/vue3-jest": "^29.2.6",
"babel-jest": "^29.7.0",
"esbuild": "^0.25.1",
"eslint-plugin-vue": "^9.17.0",
"rollup": "^4.35.0",
"rollup-plugin-esbuild": "^6.2.1",
"rollup-plugin-node-externals": "^7.1.3",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"unplugin-vue-components": "^0.25.0",
"vite-jest": "^0.1.4"
"rollup-plugin-vue": "^6.0.0",
"unplugin-vue-components": "^0.25.0"
},
"peerDependencies": {
"@aws-amplify/core": "*",
Expand Down
121 changes: 121 additions & 0 deletions packages/vue/rollup.config.mjs
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'
];

/**
* @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
};

// 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'],
}),
resolve({
extensions: ['.js', '.ts', '.vue']
}),
commonjs(),
// Vue-specific plugins
vue({
preprocessStyles: true,
template: {
isProduction: true
}
}),
postcss({
extract: 'style.css',
minimize: true,
sourceMap: true
}),
// 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"
]
}
}),
// Use esbuild for faster JavaScript transpilation
esbuild({
include: /\.[jt]sx?$/,
exclude: /node_modules|__tests__|__mocks__/,
sourceMap: true,
target: 'es2015',
tsconfig: resolvePath(tsconfig)
}),
dynamicImportVars
]
});

export default config;
2 changes: 1 addition & 1 deletion packages/vue/src/components/authenticator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ const hasRouteComponent = computed(() => {
:signOut="signOut as any"
:send="send as any"
></slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/confirm-reset-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ function onBlur(e: Event) {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/confirm-sign-in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ const onBackToSignInClicked = (): void => {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/confirm-sign-up.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ const onLostCodeClicked = (): void => {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/confirm-verify-user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ const onSkipClicked = (): void => {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/federated-sign-in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ const orText = computed(() => getOrText());
:data-label="orText"
/>
</base-wrapper>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/force-new-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ function onBlur(e: Event) {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/forgot-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ const onBackToSignInClicked = (): void => {
</base-wrapper>
</base-form>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/setup-totp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ const onBackToSignInClicked = (): void => {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/sign-in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ const onForgotPasswordClicked = (): void => {
</slot>
</base-footer>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/sign-up.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ const onSignUpSubmit = (e: Event): void => {
<slot name="footer"> </slot>
</base-footer>
</slot>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/vue/src/components/verify-user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ const onSkipClicked = (): void => {
</base-form>
</base-wrapper>
</slot>
</template>
</template>
19 changes: 19 additions & 0 deletions packages/vue/tsconfig.dist.json
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"
},
Copy link
Member

Choose a reason for hiding this comment

The 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__",
Copy link
Member

Choose a reason for hiding this comment

The 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__/**",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think line 15 is covered by line 16?

"global-spec.ts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to exclude "global-spec.ts" and not the other configs? Feels extraneous

]
}
22 changes: 15 additions & 7 deletions packages/vue/tsconfig.json
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/**/*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this directory exists?

"*.d.ts",
Copy link
Member

Choose a reason for hiding this comment

The 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__/**/*",
Copy link
Member

Choose a reason for hiding this comment

The 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"
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is setting "types" now needed?

"composite": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set "composite" now?

"rootDir": "."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set "rootDir" now?

}
}
64 changes: 0 additions & 64 deletions packages/vue/vite.config.ts

This file was deleted.

Loading
Loading