Giter Site home page Giter Site logo

esbuild-plugin-path-alias's People

Contributors

indooorsman avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ryansch outstand

esbuild-plugin-path-alias's Issues

Can't resolve path when importing on esbuild.ts

I followed the usage guide:

; (async function () {
  const entryPoints = await glob('src/**/*.ts')

  build({
    entryPoints,
    logLevel: 'info',
    outdir: 'build',
    // bundle: true,
    // minify: true,
    platform: 'node',
    format: 'cjs',
    sourcemap: true,
    plugins: [
      aliasPlugin({
        // must be absolute path
        '@': path.resolve(__dirname, "./src")
      })
      // esbuildPluginFastifySwaggerUi(),
      // esbuildPluginPino({ transports: ['pino-pretty'] }),
    ],
  });
})()

But I still get an error when importing from a build js file

image

Can't resolve path when importing from js.

I followed the usage guide:

const vuePlugin = require("esbuild-plugin-vue3");
const { sassPlugin } = require("esbuild-sass-plugin");
const aliasPlugin = require('esbuild-plugin-path-alias');
const path = require('path');

require("esbuild").build({
  entryPoints: ["app/javascript/application.js"],
  bundle: true,
  minify: process.argv[2] === "--minify=true",
  watch: process.argv[2] === "--watch=true",
  outfile: "app/assets/builds/application.js",
  logLevel: "info",
  plugins: [vuePlugin(), sassPlugin(),
    aliasPlugin({
      "~": path.resolve(__dirname, "./app/javascript/components")
    })
  ],
}).catch(() => process.exit(1));

But I still get an error when importing from a js file. It works when importing from .vue files though.
Any thoughts?

image

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.