diff --git a/package.json b/package.json
index 9a51ca5..7f2a3b7 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/runtime": "^7.9.2",
+ "@rollup/plugin-alias": "^3.0.1",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-replace": "^2.3.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ccd962c..1ed829c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -15,6 +15,7 @@ devDependencies:
'@babel/plugin-transform-runtime': 7.9.0_@babel+core@7.9.0
'@babel/preset-env': 7.9.0_@babel+core@7.9.0
'@babel/runtime': 7.9.2
+ '@rollup/plugin-alias': 3.0.1_rollup@2.3.0
'@rollup/plugin-commonjs': 11.0.2_rollup@2.3.0
'@rollup/plugin-node-resolve': 7.1.1_rollup@2.3.0
'@rollup/plugin-replace': 2.3.1_rollup@2.3.0
@@ -891,6 +892,15 @@ packages:
dev: false
resolution:
integrity: sha512-3NsZsJIA/22P3QUyrEDNA2D133H4j224twJrdipXN38dpnIOzAbUDtOwkcJ5pXmn75w7LSQDjA4tO9dm1XlqlA==
+ /@rollup/plugin-alias/3.0.1_rollup@2.3.0:
+ dependencies:
+ rollup: 2.3.0
+ slash: 3.0.0
+ dev: true
+ peerDependencies:
+ rollup: ^1.20.0
+ resolution:
+ integrity: sha512-ReSy6iPl3GsWLMNeshXAfgItZFMoMOTYC7MZQQM5va4pqxiGgwl1xZUZfHW6zGyZPK+k8TBadxx+kdmepiUa+g==
/@rollup/plugin-commonjs/11.0.2_rollup@2.3.0:
dependencies:
'@rollup/pluginutils': 3.0.8_rollup@2.3.0
@@ -3963,6 +3973,12 @@ packages:
node: '>= 6'
resolution:
integrity: sha512-dQbZnsMaIiTQPZmbGmktz+c74zt/hyrJEB4tdp2Jj0RNv9J6B/OWR5RyrZEvIn9fyh9Zlg2OlE2XzKz6wMKGAw==
+ /slash/3.0.0:
+ dev: true
+ engines:
+ node: '>=8'
+ resolution:
+ integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
/slice-ansi/2.1.0:
dependencies:
ansi-styles: 3.2.1
@@ -4515,6 +4531,7 @@ specifiers:
'@babel/plugin-transform-runtime': ^7.9.0
'@babel/preset-env': ^7.9.0
'@babel/runtime': ^7.9.2
+ '@rollup/plugin-alias': ^3.0.1
'@rollup/plugin-commonjs': ^11.0.2
'@rollup/plugin-node-resolve': ^7.1.1
'@rollup/plugin-replace': ^2.3.1
diff --git a/rollup.config.js b/rollup.config.js
index 3d21ca6..0790896 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,4 +1,6 @@
+import path from 'path'
import resolve from '@rollup/plugin-node-resolve'
+import alias from '@rollup/plugin-alias'
import replace from '@rollup/plugin-replace'
import commonjs from '@rollup/plugin-commonjs'
import svelte from 'rollup-plugin-svelte'
@@ -32,6 +34,19 @@ const preprocess = autoPreprocess({
postcss: true
})
+// Resolve and Alias
+const resolveExtensions = ['.mjs', '.js', '.svelte', '.scss', '.json', '.html']
+const aliases = alias({
+ resolve: resolveExtensions,
+ entries: [
+ { find: 'utils', replacement: path.resolve(__dirname, 'src/utils') },
+ { find: 'animations', replacement: path.resolve(__dirname, 'src/animations') },
+ { find: 'atoms', replacement: path.resolve(__dirname, 'src/atoms') },
+ { find: 'molecules', replacement: path.resolve(__dirname, 'src/molecules') },
+ { find: 'organisms', replacement: path.resolve(__dirname, 'src/organisms') },
+ ]
+})
+
export default {
/*
@@ -53,15 +68,16 @@ export default {
emitCss: true,
// css: css => css.write('static/bundle.css')
}),
+ aliases,
resolve({
browser: true,
- extensions: ['.mjs', '.js', '.svelte', '.scss', '.json', '.html'],
+ extensions: resolveExtensions,
dedupe: ['svelte']
}),
commonjs(),
// dev && eslint(),
legacy && babel({
- extensions: ['.js', '.mjs', '.html', '.svelte'],
+ extensions: resolveExtensions,
exclude: ['*.scss', '*.css', 'node_modules/@babel/**'],
runtimeHelpers: true
}),
@@ -92,12 +108,13 @@ export default {
preprocess,
generate: 'ssr'
}),
+ aliases,
resolve({
browser: true,
- extensions: ['.mjs', '.js', '.json', '.html', '.svelte', '.scss'],
+ extensions: resolveExtensions,
dedupe: ['svelte']
}),
- commonjs(),
+ commonjs()
],
external: Object.keys(pkg.dependencies).concat(
require('module').builtinModules || Object.keys(process.binding('natives'))
@@ -114,6 +131,7 @@ export default {
// output: sapperConfig.serviceworker.output(),
// plugins: [
// resolve(),
+ // aliases,
// replace({
// 'process.browser': true,
// ...replaceOptions
diff --git a/src/animations/Carousel.js b/src/animations/Carousel.js
index 624fbf7..0fe7761 100644
--- a/src/animations/Carousel.js
+++ b/src/animations/Carousel.js
@@ -1,6 +1,6 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
-import { animDuration } from '../utils/store'
+import { animDuration } from 'utils/store'
/*
diff --git a/src/animations/Locations.js b/src/animations/Locations.js
index 72aca46..6fa5090 100644
--- a/src/animations/Locations.js
+++ b/src/animations/Locations.js
@@ -1,6 +1,6 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
-import { animDuration } from '../utils/store'
+import { animDuration } from 'utils/store'
/*
diff --git a/src/animations/Photo.js b/src/animations/Photo.js
index 8ef4226..749c3b0 100644
--- a/src/animations/Photo.js
+++ b/src/animations/Photo.js
@@ -1,8 +1,8 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
import imagesLoaded from 'imagesloaded'
-import { animDuration, animDurationLong } from '../utils/store'
-import { throttle, parallaxAnime } from '../utils/functions'
+import { animDuration, animDurationLong } from 'utils/store'
+import { throttle, parallaxAnime } from 'utils/functions'
/*
diff --git a/src/animations/TitleSite.js b/src/animations/TitleSite.js
index a91693e..ecab523 100644
--- a/src/animations/TitleSite.js
+++ b/src/animations/TitleSite.js
@@ -1,6 +1,6 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
-import { animDuration } from '../utils/store'
+import { animDuration } from 'utils/store'
/*
diff --git a/src/animations/Transition.js b/src/animations/Transition.js
index a1cd93f..fb0e9c3 100644
--- a/src/animations/Transition.js
+++ b/src/animations/Transition.js
@@ -1,5 +1,5 @@
import anime from 'animejs'
-import { animDuration, animDurationLong } from '../utils/store'
+import { animDuration, animDurationLong } from 'utils/store'
/*
diff --git a/src/animations/index.js b/src/animations/index.js
index 9f1c852..edbe674 100644
--- a/src/animations/index.js
+++ b/src/animations/index.js
@@ -1,7 +1,7 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
-import { animDuration } from '../utils/store'
-import { throttle, parallaxAnime } from '../utils/functions'
+import { animDuration } from 'utils/store'
+import { throttle, parallaxAnime } from 'utils/functions'
/*
diff --git a/src/animations/page.js b/src/animations/page.js
index 3baba56..4070588 100644
--- a/src/animations/page.js
+++ b/src/animations/page.js
@@ -1,6 +1,6 @@
import anime from 'animejs'
import ScrollOut from 'scroll-out'
-import { animDuration, animDurationLong } from '../utils/store'
+import { animDuration, animDurationLong } from 'utils/store'
/*
diff --git a/src/animations/place.js b/src/animations/place.js
index 38e00d3..788f8f1 100644
--- a/src/animations/place.js
+++ b/src/animations/place.js
@@ -1,6 +1,6 @@
import anime from 'animejs'
// import ScrollOut from 'scroll-out'
-import { animDuration } from '../utils/store'
+import { animDuration } from 'utils/store'
/*
diff --git a/src/animations/viewer.js b/src/animations/viewer.js
index 4bfec5c..ec3a3c4 100644
--- a/src/animations/viewer.js
+++ b/src/animations/viewer.js
@@ -1,5 +1,5 @@
import anime from 'animejs'
-import { animDuration } from '../utils/store'
+import { animDuration } from 'utils/store'
/*
diff --git a/src/atoms/IconGlobe.svelte b/src/atoms/IconGlobe.svelte
index 0eab929..5468d29 100644
--- a/src/atoms/IconGlobe.svelte
+++ b/src/atoms/IconGlobe.svelte
@@ -1,6 +1,6 @@