Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceMap path to file and plugins in webpackConfig #2437

Closed
EugenGedroyc opened this issue Jul 10, 2020 · 2 comments
Closed

SourceMap path to file and plugins in webpackConfig #2437

EugenGedroyc opened this issue Jul 10, 2020 · 2 comments
Labels

Comments

@EugenGedroyc
Copy link

  • Laravel Mix Version: laravel-mix@5.0.4
  • Node Version: v14.0.0
  • NPM Version (npm -v): 6.14.4
  • OS: Ubuntu 18.04

Description:

I need same. Removes the webpack:/// prefix: webpack-contrib/css-loader#622 (comment)
and in finall get "file:///D:/my-site/resources/less/style.less"
This code generating maps file with path: http://my-site.dev/resources/less/style.less

mix.webpackConfig({ 
output: { devtoolModuleFilenameTemplate: '[resource-path]' }, 
})
.sourceMaps(false, 'inline-source-map');

and this don't helped me:

devtoolModuleFilenameTemplate: 'file:///D:/[namespace]'

I tried this plugin: https://webpack.js.org/plugins/source-map-dev-tool-plugin/

const SourceMapDevToolPlugin = require('source-map-dev-tool-plugin');
mix
  .webpackConfig({ 
    devtool: false,
    plugins: [
      
      new SourceMapDevToolPlugin({
        filename: "[file].map",
        moduleFilenameTemplate: '[absolute-resource-path]',
      }),
    ]
output: Error: ReferenceError: SourceMapDevToolPlugin is not defined

I don't know how can install webpack plugins. I have same trouble with const NpmInstallPlugin = require('npm-install-webpack-plugin'):
webpack-contrib/install-webpack-plugin#122

Steps To Reproduce:

  1. edit webpack.mix.js
  2. npm run dev
@EugenGedroyc
Copy link
Author

Solution:

.webpackConfig({ output: {
  devtoolModuleFilenameTemplate: info => {
    let path = 'D:/my-site/resources/less/';
    return `file:///${path}${info.resourcePath.slice(2)}`;
  }
}
}).sourceMaps(false, 'inline-source-map');

Sadly, styles not saving in the tab "Styles", but it work in the Sources
styles

@stale
Copy link

stale bot commented Sep 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 12, 2020
@stale stale bot closed this as completed Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant