From b1afc25e0a957f01f98074a332b01a35f4f8d776 Mon Sep 17 00:00:00 2001 From: Alvaro Saburido Date: Sat, 3 Oct 2020 12:16:00 +0200 Subject: [PATCH] feat(build): add alias to rollup --- dev/typescript/App.vue | 4 ++-- dev/typescript/main.ts | 4 ++-- package-lock.json | 9 +++++++++ package.json | 1 + rollup.config.js | 4 ++++ src/components/checkbox-input/CheckboxInput.vue | 4 ++-- src/components/dynamic-form/DynamicForm.vue | 4 ++-- src/components/dynamic-input/DynamicInput.vue | 8 ++++---- src/components/number-input/NumberInput.vue | 4 ++-- src/components/radio-input/RadioInput.vue | 4 ++-- src/components/select-input/SelectInput.vue | 4 ++-- src/components/text-area-input/TextAreaInput.vue | 4 ++-- src/components/text-input/TextInput.vue | 4 ++-- 13 files changed, 36 insertions(+), 22 deletions(-) diff --git a/dev/typescript/App.vue b/dev/typescript/App.vue index 0d4030d..3fb161c 100644 --- a/dev/typescript/App.vue +++ b/dev/typescript/App.vue @@ -60,8 +60,8 @@ import { pattern, ColorInput, NumberInput, -} from '../../src'; -/* } from '../../dist/as-dynamic-forms.esm'; */ + /* } from '../../src'; */ +} from '../../dist/as-dynamic-forms.esm'; export default defineComponent({ name: 'app', setup() { diff --git a/dev/typescript/main.ts b/dev/typescript/main.ts index 3b77c39..e9b39ea 100644 --- a/dev/typescript/main.ts +++ b/dev/typescript/main.ts @@ -3,9 +3,9 @@ import { createApp } from 'vue'; import App from './App.vue'; import './styles/main.scss'; -import { createDynamicForms } from '../../src'; +// import { createDynamicForms } from '../../src'; -// import { createDynamicForms } from '../../dist/as-dynamic-forms.esm'; +import { createDynamicForms } from '../../dist/as-dynamic-forms.esm'; const VueDynamicForms = createDynamicForms({ autoValidate: true, diff --git a/package-lock.json b/package-lock.json index 9be462c..590ecd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3882,6 +3882,15 @@ "@types/node": ">= 8" } }, + "@rollup/plugin-alias": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz", + "integrity": "sha512-hNcQY4bpBUIvxekd26DBPgF7BT4mKVNDF5tBG4Zi+3IgwLxGYRY0itHs9D0oLVwXM5pvJDWJlBQro+au8WaUWw==", + "dev": true, + "requires": { + "slash": "^3.0.0" + } + }, "@rollup/plugin-buble": { "version": "0.21.3", "resolved": "http://localhost:4873/@rollup%2fplugin-buble/-/plugin-buble-0.21.3.tgz", diff --git a/package.json b/package.json index 12cee9e..b54aa21 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ }, "devDependencies": { "@microsoft/api-extractor": "^7.10.1", + "@rollup/plugin-alias": "^3.1.1", "@rollup/plugin-buble": "^0.21.3", "@rollup/plugin-commonjs": "^15.1.0", "@rollup/plugin-node-resolve": "^9.0.0", diff --git a/rollup.config.js b/rollup.config.js index 236b891..28ed82d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,6 +7,7 @@ import commonjs from '@rollup/plugin-commonjs'; import { terser } from 'rollup-plugin-terser'; import ts from 'rollup-plugin-typescript2'; import vue from 'rollup-plugin-vue'; +import alias from '@rollup/plugin-alias'; import pkg from './package.json'; const name = 'as-dynamic-forms'; @@ -89,6 +90,9 @@ function createConfig(format, output, plugins = []) { // used alone. external, plugins: [ + alias({ + entries: [{ find: '@', replacement: path.resolve(__dirname, 'src') }], + }), tsPlugin, vue(), createReplacePlugin( diff --git a/src/components/checkbox-input/CheckboxInput.vue b/src/components/checkbox-input/CheckboxInput.vue index b6c1e60..c7fcb71 100644 --- a/src/components/checkbox-input/CheckboxInput.vue +++ b/src/components/checkbox-input/CheckboxInput.vue @@ -1,7 +1,7 @@