Va1 / string-replace-loader

Replace loader for Webpack
MIT License
250 stars 57 forks source link

I am unable to use this. I want chnage assets path in generated js file in build. #27

Closed bankimatglobant closed 3 years ago

bankimatglobant commented 7 years ago

I am unable to use this. I want change assets path in generated js file in build. Please provide me detail steps to implement this.

Currently, I have added below code in webpack.dev.js file.

module: { loaders: [ { test: /.*/, loader: 'string-replace', query: { search: 'locales', replace: 'bankim', }, exclude: /node_modules/ } ],

And use npm install --save-dev string-replace-loader

Let me know if I miss something.

Va1 commented 6 years ago

@bankimatglobant sorry for the delayed reply. i would recommend to add flags: 'g' to query and see what happens. without this flag it may be replacing only first occurrence (RegEx features)

gavinmcfarland commented 3 years ago

This worked for me. I wasn't sure why it wasn't doing anything, even though I didn't think there was more than one occurrence, but adding this flag meant there must have been a match somewhere that I couldn't see.

Va1 commented 3 years ago

@limitlessloop thanks for posting, glad it helped you out. i assume i can close this thread now