M
M
Maxim Ivanov2016-11-03 14:33:28
npm
Maxim Ivanov, 2016-11-03 14:33:28

How to find out which modules and dependencies I need to cut in a package?

I want to learn how to easily transfer project builds
Webpack is not installed on another computer, but it’s not clear what other libraries it pulls along with it
Here is the webpack.congif.js file

'use strict';

const NODE_ENV = process.env.NODE_ENV || 'default';
const webpack = require('webpack');
const path = require('path');

module.exports = {

  context: __dirname, // точка входа в приложение

  entry: { // точки входа
    core: './es6/core.js',
    app: './es6/app.module.js'
  },

  output: { // выходные файлы
    path: '../webapp/js/',
    publicPath: '/js/',
    filename: '[name].js',
    library: '[name]'
  },

  //watch: NODE_ENV == 'default', // прослушиваем изменения
  watch: true, // прослушиваем изменения
  watchOptions: {
    aggregateTimeout: 100
  },

  //devtool: NODE_ENV == 'default' ? 'source-map' : null, // дебаг
  devtool: 'source-map', // дебаг

  plugins: [
    new webpack.NoErrorsPlugin(), // отключение сборки, если возникла ошибка

    new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        Hammer: 'hammerjs/hammer'
    }),

    new webpack.optimize.CommonsChunkPlugin({
      name: 'core'
    }),

    new webpack.DefinePlugin({
      NODE_ENV: JSON.stringify(NODE_ENV),
      LANG: JSON.stringify('ru')
    })
  ],

  resolveUrlLoader: {
     keepQuery: true,
     absolute: true
   },

  module: {

    loaders: [
        { // используем ES6 to ES5
          test: /\.js$/,
          exclude: /(node_modules|bower_components)/,
          loader: 'babel', // 'babel-loader' is also a legal name to reference
          query: {
            presets: ['es2015'],
            compact : false
          }
        },
        {
            test: /\.html$/,
            loader: 'html'
          },
        {
          test: /\.scss$/,
          loaders: ['style', 'css', 'resolve-url', 'sass?sourceMap']
        },
    ]
  },

  htmlLoader: {
    ignoreCustomFragments: [/\{\{.*?}}/],
    root: path.resolve(__dirname, 'assets'),
    attrs: ['img:src', 'link:href']
  }

};

/*if (NODE_ENV != 'default') {

  module.exports.plugins.push( // оптимизация файлов JS
    new webpack.optimize.UglifyJsPlugin({
      minimize: true,
      compress: {
        warnings: true,
        drop_console:true,
        unsafe: true
      }
    })

  )

}

*/

There it seems to be written package.json

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question