B
B
badgoto2016-04-20 19:25:59
JavaScript
badgoto, 2016-04-20 19:25:59

Is it possible to combine the common.js syntax with the effect of require.js?

As I understand it, when using the AMD(requirejs) system, I get a scattering of wrapped js files at the output. Which are very convenient to debug. There is modularity here and it is convenient to debug. In the case of commonjs (browserify) or es6 (using webpack + "babel-loader"), I get 1 file (bundle.js), which is inconvenient to debug. Is it possible to use a more convenient commonjs or es6 modules syntax, but at the same time for dev mode to get exactly a scattering of files, without compiling into a single file, as is obtained when using requirejs ?
PS I understand that there are sourcemaps for a file assembled in 1, but this is for prosuction and for the assembled file, and for dev I would like separate files.
PPS used only extjs before, everything went out of the box (Ext.Loader), if you messed up something, don't judge strictly, I'm just in the process of understanding.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ninja Mate, 2016-04-20
@badgoto

As the simplest option, you can set

if (process.env.NODE_ENV === 'production') //сюда вставляете способ импорта
, you can specify breaking into chunks for different assembly versions in the webpack settings themselves

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question