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

Migrate building CommonJS module entrypoint to vite #4329

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"cypress:gui": "TZ=UTC cypress open --component",
"cypress:update-snapshots": "TZ=UTC cypress run --component --spec cypress/visual/**/*.cy.js --env type=base --config screenshotsFolder=cypress/snapshots/base"
},
"main": "dist/index.js",
"main": "dist/index.cjs",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.cjs"
},
"./dist/": "./dist/"
},
Expand Down Expand Up @@ -103,7 +103,7 @@
"@nextcloud/eslint-config": "^8.3.0-beta.0",
"@nextcloud/stylelint-config": "^2.3.1",
"@nextcloud/webpack-vue-config": "github:nextcloud/webpack-vue-config#master",
"@susnux/nextcloud-vite-config": "^1.0.0-beta.13",
"@susnux/nextcloud-vite-config": "^1.0.0-beta.15",
"@vue/test-utils": "^1.3.0",
"@vue/tsconfig": "^0.4.0",
"@vue/vue2-jest": "^29.0.0",
Expand Down
7 changes: 6 additions & 1 deletion styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = async () => {
module: {
// Ignore eslint
rules: base.module.rules.filter(
rule => rule.use !== 'eslint-loader'
rule => rule.use !== 'eslint-loader',
),
},
})
Expand Down Expand Up @@ -43,6 +43,11 @@ module.exports = async () => {
},
},
},
resolve: {
alias: {
vue: 'vue/dist/vue.js',
},
},
}),

exampleMode: 'collapse',
Expand Down
4 changes: 2 additions & 2 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default defineConfig((env) => {
},
// For backwards compatibility we include the css within the js files
inlineCSS: true,
// Disable polyfills
coreJS: false,
// Build CommonJS files for backwards compatibility
libraryFormats: ['es', 'cjs'],
replace: {
PRODUCTION: JSON.stringify(env.mode === 'production'),
SCOPE_VERSION,
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ console.info('This build version hash is', versionHash, '\n')

webpackConfig.entry = {
install: path.join(__dirname, 'src', 'install.js'),
index: path.join(__dirname, 'src', 'index.js'),

...globSync('src/components/*/index.js').reduce((acc, item) => {
const name = item
Expand Down