0

Webpack not removing unused code in production (final) bundle

Here is my scenario

file-a.js

import {otherfunction} from "./anotherFile.js"

export const sendAjaxRequest() /**  common function to send a ajax Request**\

file-b.js

import {sendAjaxRequest} from "./file-a.js"

consuming the imported method 

Final Bundle Contains all the method of file-a.js

  • set sideEffect false in package.json
  • configured babel to stop transpile module ( ['@babel/preset-env',{modules: false}])

Final Bundle :- file-b.js + file-a.js + file-a *imports files.js

What am missing ?

Vijay
  • 49
  • 4

0 Answers0