bholloway / resolve-url-loader

Webpack loader that resolves relative paths in url() statements based on the original source file
563 stars 71 forks source link

webpack4 background url absolute path cannt work #110

Closed Tim-ls closed 5 years ago

Tim-ls commented 5 years ago
  {
    loader: require.resolve('resolve-url-loader')
  },
  {
    loader: require.resolve('sass-loader'),
    options: {
      sourceMap: isEnvProduction && shouldUseSourceMap
    }
  }

webpack4 alias: src: path.join(__dirname, '..', 'src') such as : 'src/app/test.png' error: not found if add '~src/app/test.png' can work. hope help!!! thanks

bholloway commented 5 years ago

That is a module URL. You need the tilde.

Look at the readme. This loader is for fully relative URL.

Tim-ls commented 5 years ago

@bholloway but image file name can't found, such as: url('test.png')

bholloway commented 5 years ago

@Tim-ls I need a substantial description of your problem. Including the files structure. I don't know what the alias has to do with your problem.

The resolve-url-loader is for assets fully relative to your source sass files.

bholloway commented 5 years ago

Closing due to inactivity