Skip to content

Commit

Permalink
chore: use type module in root (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Oct 6, 2023
1 parent aa03882 commit b194ef4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ module.exports = {
browser: true
}
},
{
// eslint is not great at detecting the esm/cjs context of a file,
// mistreating `require` and `module` globals as undefined
files: [
'packages/e2e-tests/_test_dependencies/cjs-only/**',
'packages/e2e-tests/_test_dependencies/index-only/**',
'packages/e2e-tests/_test_dependencies/vite-plugins/**'
],
rules: {
'no-undef': 'off'
}
},
{
files: ['packages/e2e-tests/**/vite.config.js', 'packages/playground/**'],
rules: {
Expand Down
5 changes: 3 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = {
/** @type {import("prettier").Config} */
export default {
useTabs: true,
singleQuote: true,
trailingComma: 'none',
printWidth: 100,
plugins: [require('prettier-plugin-svelte')],
plugins: ['prettier-plugin-svelte'],
overrides: [
{
files: '**/*.svx',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "vite-plugin-svelte-monorepo",
"private": true,
"type": "module",
"scripts": {
"test": "run-s -c test:unit test:build test:serve",
"test:unit": "vitest run",
Expand Down
3 changes: 2 additions & 1 deletion packages/vite-plugin-svelte/src/utils/load-svelte-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
// identify which require function to use (esm and cjs mode)
const _require = import.meta.url
? esmRequire ?? (esmRequire = createRequire(import.meta.url))
: require;
: // eslint-disable-next-line no-undef
require;

// avoid loading cached version on reload
delete _require.cache[_require.resolve(configFile)];
Expand Down

0 comments on commit b194ef4

Please sign in to comment.