Skip to content

Commit

Permalink
[FIX] some useless external imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mathix420 committed Jun 16, 2021
1 parent aca2cb0 commit 770c20d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 40 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Vuito is fully tree-shakable, so you can import only the methods you need.
```javascript
import { regex, required } from 'vuito';
```

**Directly in the browser**
```javascript
import { regex, required } from 'https://esm.run/vuito';
```

## Templates
With templates you can easily create and reuse validations.

Expand Down
74 changes: 39 additions & 35 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuito",
"version": "1.1.5",
"version": "1.1.6",
"description": "Simple, lightweight, isomorphic, and template-based validation library.",
"main": "vuito.cjs.js",
"module": "vuito.esm.js",
Expand Down
20 changes: 16 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import cleanup from 'rollup-plugin-cleanup';
import path from 'path';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('./package.json');
Expand All @@ -13,6 +14,13 @@ const globals = {
...packageJson.devDependencies,
};

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function extractChunks(id) {
if (id.includes('tslib')) return 'template';
if (id.includes('/validators/')) return 'validators/' + path.parse(id).name;
return path.parse(id).name;
}

export default {
input: 'src/vuito.ts',
output: [
Expand All @@ -21,13 +29,16 @@ export default {
format: 'cjs', // commonJS
exports: 'auto',
sourcemap: true,
entryFileNames: '[name].cjs.js',
esModule: false,
preserveModulesRoot: 'src',
preserveModules: true,
manualChunks: extractChunks,
entryFileNames: '[name].cjs.js',
chunkFileNames: '[name].cjs.js',
},
{
file: 'lib/vuito.min.js',
format: 'cjs', // commonJS
esModule: false,
plugins: [terser()], // minified
sourcemap: true,
},
Expand All @@ -42,9 +53,10 @@ export default {
dir: 'lib',
format: 'esm', // ES Modules
sourcemap: true,
entryFileNames: '[name].esm.js',
preserveModulesRoot: 'src',
preserveModules: true,
manualChunks: extractChunks,
entryFileNames: '[name].esm.js',
chunkFileNames: '[name].esm.js',
},
],
plugins: [
Expand Down

0 comments on commit 770c20d

Please sign in to comment.