0

I am currently using the webpack raw loader to load a file like so:

import svg from '!!raw-loader!./../../public/images/svg/project/flag.svg';

I am using this with Vue.js and I would like to create a method, mixer or plugin to resolve automatically to my public path.

How can I make the raw loader start from the root of my project instead of building up a relative path?

Stephan-v
  • 19,255
  • 31
  • 115
  • 201

1 Answers1

0

Found the answer here:

http://moduscreate.com/es6-es2015-import-no-relative-path-webpack/

Added this to my webpack config, which now works fine:

resolve: {
    modules: [
        path.resolve('./'),
        path.resolve('./node_modules')
    ]
}
Stephan-v
  • 19,255
  • 31
  • 115
  • 201