Support for non relative path imports in client code:

So this:

import { Paginator } from "../../lib";

Becomes:

import { Paginator } from "@/lib";

Makes code cleaner and more portable.
This commit is contained in:
Arik Fraimovich 2017-10-26 09:58:24 +03:00
parent acd33ec852
commit 047475562d
4 changed files with 232 additions and 22 deletions

View File

@ -1,6 +1,9 @@
module.exports = {
root: true,
extends: "airbnb-base",
settings: {
"import/resolver": "webpack"
},
env: {
"browser": true,
"node": true

244
package-lock.json generated
View File

@ -4,6 +4,16 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@plotly/d3-sankey": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@plotly/d3-sankey/-/d3-sankey-0.5.0.tgz",
"integrity": "sha1-si+up0LlglEzXuXZ+6JIdyYHgA8=",
"requires": {
"d3-array": "1.2.1",
"d3-collection": "1.0.4",
"d3-interpolate": "1.1.5"
}
},
"3d-view": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/3d-view/-/3d-view-2.0.0.tgz",
@ -26,21 +36,6 @@
"right-now": "1.0.0"
}
},
"@plotly/d3-sankey": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@plotly/d3-sankey/-/d3-sankey-0.5.0.tgz",
"integrity": "sha1-si+up0LlglEzXuXZ+6JIdyYHgA8=",
"requires": {
"d3-array": "1.2.1",
"d3-collection": "1.0.4",
"d3-interpolate": "1.1.5"
}
},
"JSV": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz",
"integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c="
},
"a-big-triangle": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/a-big-triangle/-/a-big-triangle-1.0.3.tgz",
@ -374,6 +369,12 @@
"resolved": "https://registry.npmjs.org/array-bounds/-/array-bounds-1.0.1.tgz",
"integrity": "sha512-8wdW3ZGk6UjMPJx/glyEt0sLzzwAE1bhToPsO1W2pbpR2gULyxe3BjSiuJFheP50T/GgODVPz2fuMUmIywt8cQ=="
},
"array-find": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz",
"integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=",
"dev": true
},
"array-find-index": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
@ -3513,6 +3514,131 @@
}
}
},
"eslint-import-resolver-webpack": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.8.3.tgz",
"integrity": "sha512-xLSNz4KbWvb8KrkDqWSmgmztq8uXq7R/rviOw1DYrh3Luxc8vpMnwO4hOt9Eot45VBiyjt1PxidrvJbZIWlItA==",
"dev": true,
"requires": {
"array-find": "1.0.0",
"debug": "2.6.9",
"enhanced-resolve": "0.9.1",
"find-root": "0.1.2",
"has": "1.0.1",
"interpret": "1.0.4",
"is-absolute": "0.2.6",
"lodash.get": "3.7.0",
"node-libs-browser": "1.1.1",
"resolve": "1.4.0",
"semver": "5.4.1"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"enhanced-resolve": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz",
"integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11",
"memory-fs": "0.2.0",
"tapable": "0.1.10"
}
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
"memory-fs": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz",
"integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=",
"dev": true
},
"node-libs-browser": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-1.1.1.tgz",
"integrity": "sha1-KjgkOr7dff/NB6l8mspWaJdab+o=",
"dev": true,
"requires": {
"assert": "1.4.1",
"browserify-zlib": "0.1.4",
"buffer": "4.9.1",
"console-browserify": "1.1.0",
"constants-browserify": "1.0.0",
"crypto-browserify": "3.11.1",
"domain-browser": "1.1.7",
"events": "1.1.1",
"https-browserify": "0.0.1",
"os-browserify": "0.2.1",
"path-browserify": "0.0.0",
"process": "0.11.10",
"punycode": "1.4.1",
"querystring-es3": "0.2.1",
"readable-stream": "2.3.3",
"stream-browserify": "2.0.1",
"stream-http": "2.7.2",
"string_decoder": "0.10.31",
"timers-browserify": "1.4.2",
"tty-browserify": "0.0.0",
"url": "0.11.0",
"util": "0.10.3",
"vm-browserify": "0.0.4"
}
},
"readable-stream": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
"dev": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"safe-buffer": "5.1.1",
"string_decoder": "1.0.3",
"util-deprecate": "1.0.2"
},
"dependencies": {
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
}
}
},
"tapable": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz",
"integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=",
"dev": true
},
"timers-browserify": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz",
"integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=",
"dev": true,
"requires": {
"process": "0.11.10"
}
}
}
},
"eslint-loader": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/eslint-loader/-/eslint-loader-1.9.0.tgz",
@ -4032,6 +4158,12 @@
"pkg-dir": "2.0.0"
}
},
"find-root": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/find-root/-/find-root-0.1.2.tgz",
"integrity": "sha1-mNImfP8ZFsyvJ0OzoO6oHXnX3NE=",
"dev": true
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
@ -6365,6 +6497,16 @@
"integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=",
"dev": true
},
"is-absolute": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.2.6.tgz",
"integrity": "sha1-IN5p89uULvLYe5wto28XIjWxtes=",
"dev": true,
"requires": {
"is-relative": "0.2.1",
"is-windows": "0.2.0"
}
},
"is-absolute-url": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz",
@ -6549,6 +6691,15 @@
"has": "1.0.1"
}
},
"is-relative": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz",
"integrity": "sha1-0n9MfVFtF1+2ENuEu+7yPDvJeqU=",
"dev": true,
"requires": {
"is-unc-path": "0.1.2"
}
},
"is-resolvable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz",
@ -6583,12 +6734,27 @@
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"is-unc-path": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-0.1.2.tgz",
"integrity": "sha1-arBTpyVzwQJQ/0FqOBTDUXivObk=",
"dev": true,
"requires": {
"unc-path-regex": "0.1.2"
}
},
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
},
"is-windows": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz",
"integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=",
"dev": true
},
"is-wsl": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
@ -6741,6 +6907,11 @@
"verror": "1.10.0"
}
},
"JSV": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz",
"integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c="
},
"kdbush": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-1.0.1.tgz",
@ -6936,6 +7107,12 @@
"integrity": "sha1-dVC06SGO8J+tJDQ7YSAhx5tMIMI=",
"dev": true
},
"lodash._baseget": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/lodash._baseget/-/lodash._baseget-3.7.2.tgz",
"integrity": "sha1-G2rh1frPPCVTI1ChPBGXy4u2dPQ=",
"dev": true
},
"lodash._baseisequal": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/lodash._baseisequal/-/lodash._baseisequal-3.0.7.tgz",
@ -6956,6 +7133,15 @@
"resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U="
},
"lodash._topath": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/lodash._topath/-/lodash._topath-3.8.1.tgz",
"integrity": "sha1-PsXiYGAU9MuX91X+aRTt2L/ADqw=",
"dev": true,
"requires": {
"lodash.isarray": "3.0.4"
}
},
"lodash.assign": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
@ -6980,6 +7166,16 @@
"integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=",
"dev": true
},
"lodash.get": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-3.7.0.tgz",
"integrity": "sha1-POaK4skWg7KBzFOUEoMDy/deaR8=",
"dev": true,
"requires": {
"lodash._baseget": "3.7.2",
"lodash._topath": "3.8.1"
}
},
"lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
@ -8606,8 +8802,8 @@
"resolved": "https://registry.npmjs.org/plotly.js/-/plotly.js-1.30.1.tgz",
"integrity": "sha1-kcHsdm6FTnnK6FTH6VOjfYcxGT8=",
"requires": {
"3d-view": "2.0.0",
"@plotly/d3-sankey": "0.5.0",
"3d-view": "2.0.0",
"alpha-shape": "1.0.0",
"color-rgba": "1.1.1",
"convex-hull": "1.0.3",
@ -11126,6 +11322,11 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -11163,11 +11364,6 @@
"function-bind": "1.1.1"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
@ -11694,6 +11890,12 @@
}
}
},
"unc-path-regex": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
"dev": true
},
"underscore": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",

View File

@ -69,6 +69,7 @@
"css-loader": "^0.28.7",
"eslint": "^4.8.0",
"eslint-config-airbnb-base": "^12.0.1",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.7.0",
"estraverse": "^4.2.0",

View File

@ -17,7 +17,11 @@ var config = {
filename: '[name].js',
publicPath: '/'
},
resolve: {
alias: {
'@': path.join(__dirname, 'client/app')
}
},
plugins: [
new WebpackBuildNotifierPlugin({title: 'Redash'}),
new webpack.DefinePlugin({