Webpack resolve alias not working with #something

Viewed 437

I have the following configuration in webpack config:

    {
      resolve: {
        alias: {
          "@":     path.resolve(__dirname, '/src'),
          "#root": path.resolve(__dirname, '/src')
        },
        extensions: ['.js', '.vue', '.json']
      }
     }

The following both fail:

    import test from '#root/test.js'
    const test from '#root/test.js'

These both work:

    import test from '@/test.js'
    const test from '@/test.js'

I'm using webpack version "4.46.0" as a part of vue version "3.0.5".

How can I get my #root syntax to work?

(note: this is to align the existing webpack 4 code with the upcoming require export/imports options coming in webpack 5)

0 Answers
Related