Coder Social home page Coder Social logo

alias-quokka-plugin's People

Contributors

gozala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

davestewart

alias-quokka-plugin's Issues

Is it possible to make this work with quokka global config?

I can't figure it out.

I'm trying to import project files from within a scratch file.

This is my global config (I don't understand if Quokka can use the alias here, just trying it out TBH):

{
  "pro":true,
  "plugins": ["alias-quokka-plugin"],
  "alias": {
    "@": "./src"
  }
}

This is my project's package.json:

  "quokka": {
    "babel": true,
    "plugins": ["alias-quokka-plugin"],
    "alias": {
      "@": "./src"
    }
  }

I still get:

Quokka #1 (node: v8.11.1, plugins: alias-quokka-plugin)

Cannot find module '@/core/objects/errors'

What should I be doing?

Really surprised this isn't built in.

PR to import alias configuration

Hey @Gozala

I'd like to start work on and PR an update to add support to import aliases from external files.

These could be standalone files, or tsconfig.json.

I'll add the correct to determine the alias, and handle arrays as well.

Sound good?

Usage with Alias HQ

Alias HQ is a programmatic way to piggyback aliases already configured in tsconfig.json:

As Quokka's config is JSON, it wouldn't be directly compatible, but is there some way to run it as a plugin or such like?

EDIT: looks like I might be able to get it working using babel's config

Vue.js + Webpack support?

First of all, thanks for such an awesome plugin. It's really useful.

If I could wish for one thing, it would be support for Vue.js in a Webpack environment. I spent a good amount of time trying to get your plugin working with their setup (e.g. import "x" from "@/something/here"), but I had to give up eventually.

Am I missing something, or would it be possible for you to try to make an example with Vue?

If you tried the basic Webpack template via the Vue CLI (https://github.com/vuejs/vue-cli) with your plugin, I think you'd see what I'm getting at. :)

A simple example would be really helpful.

Thanks in advance.

Note: I tried rewriting your plugin to follow the way the Vue CLI Webpack template resolves aliases (found in webpack.base.conf.js), but it didn't work.

Cannot Find Module

In my webpack setup I have the following alias:
'$route-views': resolve('src/route-views')
And in the package.json I have the following:

"quokka": {
    "pro": true,
    "babel" : true,
    "plugins": ["alias-quokka-plugin"],
    "alias": {
      "@": "src",
      "$c": "src/components",
      "$route-views": "src/route-views/dashboards/goals",

In a javascript file, I'm importing a module under that folder as such:
import {getGrid} from '$route-views/dashboards/GoalsGridDates'

However, Quokka spits out this error:

Cannot find module '$route-views/dashboards/GoalsGridHelper'
	at Function.Module._resolveFilename module.js:470
	at Module._load module.js:418
	at Function.Module._load.rest [as _load] .\node_modules\alias-quokka-plugin\src\main.js:13

does not traverse subdirectories

I have a bunch of modules under @app, for example @app/api. alias-quokka-plugin won't let me make an alias to @app, then find things under @app by traversing subdirectories.

Example:
I have few packages:

  • @app/api
  • @app/lib/interface/status
  • @app/lib/enums
  • @app/lib/controller/BaseFormController

I would like to do this and have this package traverse subdirectories by itself:

    "quokka": {
        "plugins": ["alias-quokka-plugin"],
        "alias": {
            "@app": "src/app"
        }
    },

However, I have to do it this way, which is troublesome:

    "quokka": {
        "plugins": ["alias-quokka-plugin"],
        "alias": {
            "@app/api": "src/app/api",
            "@app/lib/interface/status": "src/app/lib/interface/status",
            "@app/lib/enums": "src/app/lib/enums",
            "@app/lib/controller/BaseFormController": "src/app/lib/controller/BaseFormController"
        }
    },

Can this be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.