const path = require("path");

const absolutePath = basePath =>
  path.resolve(__dirname, "../../../../../", `app/javascript/${basePath}`);

module.exports = {
  alias: {
    apis: absolutePath("src/apis"),
    assets: absolutePath("src/assets"),
    components: absolutePath("src/components"),
    hooks: absolutePath("src/hooks"),
    reducers: absolutePath("src/reducers"),
    routes: absolutePath("src/routes"),
    stores: absolutePath("src/stores"),
    translations: absolutePath("src/translations"),
    utils: absolutePath("src/utils"),
    src: absolutePath("src"),
    stylesheets: absolutePath("stylesheets"),
    neetoui: "@bigbinary/neetoui",
    neetocommons: "@bigbinary/neeto-commons-frontend",
    neetointegrations: "@bigbinary/neeto-integrations-frontend",
    neetothemes: "@bigbinary/neeto-themes-frontend",
    neetoslack: "@bigbinary/neeto-slack-frontend",
    neetorules: "@bigbinary/neeto-rules-frontend",
    neetoapprovals: "@bigbinary/neeto-approvals-frontend",
    neetofields: "@bigbinary/neeto-fields-frontend",
    neetofolders: "@bigbinary/neeto-folders-frontend",
    neetoredirecturls: "@bigbinary/neeto-redirect-urls-frontend",
    neetogithub: "@bigbinary/neeto-github-frontend",
    neetoratelimit: "@bigbinary/neeto-rate-limit-frontend",
    neetoaccesscontrol: "@bigbinary/neeto-access-control-frontend",
    neetotags: "@bigbinary/neeto-tags-frontend",
    neetoactivities: "@bigbinary/neeto-activities-frontend",
    neetotemplates: "@bigbinary/neeto-templates-frontend",
    neetoapikeys: "@bigbinary/neeto-api-keys-frontend",
    neetoemailnotifications: "@bigbinary/neeto-email-notifications-frontend",
    neetothankyou: "@bigbinary/neeto-thank-you-frontend",
    neetoimageuploader: "@bigbinary/neeto-image-uploader-frontend",
    neetowebhooks: "@bigbinary/neeto-webhooks-frontend",
    neetoform: "@bigbinary/neeto-form-frontend",
    neetoprojects: "@bigbinary/neeto-projects-frontend",
    neetomessagetemplates: "@bigbinary/neeto-message-templates-frontend",
    neetoicons: "@bigbinary/neeto-icons",
    neetoteam: "@bigbinary/neeto-team-members-frontend",
    neetoeditor: "@bigbinary/neeto-editor",
    neetofilters: "@bigbinary/neeto-filters-frontend",
    neetomolecules: "@bigbinary/neeto-molecules",
    neetopayments: "@bigbinary/neeto-payments-frontend",
    neetocist: "@bigbinary/neeto-cist",
    neetohotkeys: "@bigbinary/neeto-hotkeys",
    "rc-picker": "@bigbinary/neeto-datepicker",
    images: path.resolve(__dirname, "../../../../../", "app/assets/images"),
  },
  extensions: [
    ".ts",
    ".mjs",
    ".js",
    ".sass",
    ".scss",
    ".css",
    ".module.sass",
    ".module.scss",
    ".module.css",
    ".png",
    ".svg",
    ".gif",
    ".jpeg",
    ".jpg",
  ],
  fallback: {
    assert: require.resolve("assert/"),
    buffer: require.resolve("buffer/"),
    crypto: require.resolve("crypto-browserify"),
    fs: false,
    http: require.resolve("stream-http"),
    https: require.resolve("https-browserify"),
    path: require.resolve("path-browserify"),
    os: require.resolve("os-browserify/browser"),
    stream: require.resolve("stream-browserify"),
    tty: require.resolve("tty-browserify"),
    url: require.resolve("url/"),
    util: require.resolve("util/"),
    zlib: require.resolve("browserify-zlib"),
    vm: require.resolve("vm-browserify"),
  },
};
