Q
Q
qwerty17772018-05-16 09:37:31
JavaScript
qwerty1777, 2018-05-16 09:37:31

How to combine all js files into one in webpack and minify them?

How to collect all js files into one in webpack 3 and minify them?
webpack config

const path = require("path");

module.exports = {
  entry: {
    custom: './web/j/custom.js',
    lity: './web/j/lity.js'
  },
  output: {
    filename: './bundle.js',
    library: 'myApp'
  }
};

Throws the following error:
ERROR in ./web/j/lity.js
Module not found: Error: Can't resolve 'jquery' in 'path/web/j'
@ ./web/j/lity.js 3:8- 5:10

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2018-05-16
@qwerty1777

npm i jquery
and in file
import jquery from 'jquery'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question