在Webpack中,我有以下插件:
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
drop_console: true,
}),
]
我想仅将UglifyJsPlugin
应用于特定目标,因此我尝试使用我想要的条件:
plugins: [
new ExtractTextPlugin('styles.css'),
(TARGET === 'build') && new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
drop_console: true,
}),
]
但是,此操作失败,显示以下错误消息:
E:\myProject\node_modules\tapable\lib\Tapable.js:164
arguments[i].apply(this);
^
TypeError: arguments[i].apply is not a function
请注意,上面的代码类似于false
数组末尾的plugins
(发出相同的错误):
plugins: [
new ExtractTextPlugin('styles.css'),
false
]
所以,问题是: 有没有办法在Webpack上有条件插件? (除了使用变量?)
答案 0 :(得分:10)
在webpack.config.js
var webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
...
},
output: {
...
},
module: {
rules: [
...
]
},
plugins: [
new ExtractTextPlugin('styles.css'),
]
};
if (TARGET === 'build') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
drop_console: true,
}),
);
}
答案 1 :(得分:8)
如果没有变量,它将如下所示:
decode_play_audio.cpp: In function ‘int main(int, char**)’:
decode_play_audio.cpp:169:9: warning: ‘void av_free_packet(AVPacket*)’ is deprecated (declared at /home/codeDev/ffmpeg_sources/build_Mar-10-2016/include/libavcodec/avcodec.h:4040) [-Wdeprecated-declarations]
av_free_packet(&packet);
^
decode_play_audio.cpp:169:31: warning: ‘void av_free_packet(AVPacket*)’ is deprecated (declared at /home/codeDev/ffmpeg_sources/build_Mar-10-2016/include/libavcodec/avcodec.h:4040) [-Wdeprecated-declarations]
av_free_packet(&packet);
^
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dvenc.o): In function `dv_init_mux':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dvenc.c:344: undefined reference to `av_dv_codec_profile2'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(matroskaenc.o): In function `get_aac_sample_rates':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskaenc.c:612: undefined reference to `avpriv_mpeg4audio_get_config'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(matroskaenc.o): In function `put_xiph_codecpriv':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskaenc.c:535: undefined reference to `avpriv_split_xiph_headers'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(movenc.o): In function `handle_eac3':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:347: undefined reference to `avpriv_ac3_parse_header'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:397: undefined reference to `avpriv_ac3_parse_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(movenc.o): In function `mov_get_rawvideo_codec_tag':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: undefined reference to `avpriv_pix_fmt_bps_mov'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(movenc.o): In function `mov_find_codec_tag':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: undefined reference to `avpriv_pix_fmt_bps_mov'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(movenc.o): In function `mov_get_rawvideo_codec_tag':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: undefined reference to `avpriv_pix_fmt_bps_mov'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: undefined reference to `avpriv_pix_fmt_bps_mov'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: undefined reference to `avpriv_pix_fmt_bps_mov'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(movenc.o):/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/movenc.c:1383: more undefined references to `avpriv_pix_fmt_bps_mov' follow
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(swfdec.o): In function `swf_read_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/swfdec.c:364: undefined reference to `uncompress'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(swfdec.o): In function `swf_read_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/swfdec.c:153: undefined reference to `inflateInit_'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(swfdec.o): In function `zlib_refill':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/swfdec.c:121: undefined reference to `inflate'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(swfdec.o): In function `swf_read_close':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/swfdec.c:529: undefined reference to `inflateEnd'
/tmp/cc18cojo.o: In function `main':
decode_play_audio.cpp:(.text+0x1ec): undefined reference to `ao_initialize'
decode_play_audio.cpp:(.text+0x1f1): undefined reference to `ao_default_driver_id'
decode_play_audio.cpp:(.text+0x313): undefined reference to `ao_open_live'
decode_play_audio.cpp:(.text+0x51e): undefined reference to `ao_play'
decode_play_audio.cpp:(.text+0x639): undefined reference to `ao_play'
decode_play_audio.cpp:(.text+0x66a): undefined reference to `ao_play'
decode_play_audio.cpp:(.text+0x729): undefined reference to `ao_play'
decode_play_audio.cpp:(.text+0x831): undefined reference to `ao_play'
/tmp/cc18cojo.o:decode_play_audio.cpp:(.text+0x8ed): more undefined references to `ao_play' follow
/tmp/cc18cojo.o: In function `main':
decode_play_audio.cpp:(.text+0x961): undefined reference to `ao_shutdown'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(frame_thread_encoder.o): In function `ff_frame_thread_encoder_free':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/frame_thread_encoder.c:236: undefined reference to `pthread_join'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(frame_thread_encoder.o): In function `ff_frame_thread_encoder_init':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/frame_thread_encoder.c:211: undefined reference to `pthread_create'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(pthread_frame.o): In function `ff_frame_thread_free':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/pthread_frame.c:566: undefined reference to `pthread_join'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(pthread_frame.o): In function `ff_frame_thread_init':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/pthread_frame.c:706: undefined reference to `pthread_create'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(pthread_slice.o): In function `ff_slice_thread_free':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/pthread_slice.c:116: undefined reference to `pthread_join'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavcodec.a(pthread_slice.o): In function `ff_slice_thread_init':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavcodec/pthread_slice.c:231: undefined reference to `pthread_create'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(allformats.o): In function `av_register_all':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/allformats.c:59: undefined reference to `avcodec_register_all'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(async.o): In function `async_close':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/async.c:313: undefined reference to `pthread_join'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(async.o): In function `async_open':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/async.c:281: undefined reference to `pthread_create'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(avidec.o): In function `avi_extract_stream_metadata':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/avidec.c:411: undefined reference to `avpriv_exif_decode_ifd'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(avienc.o): In function `avi_write_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/avienc.c:363: undefined reference to `avpriv_pix_fmt_bps_avi'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(concatdec.o): In function `detect_stream_specific':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/concatdec.c:200: undefined reference to `av_bitstream_filter_init'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(concatdec.o): In function `filter_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/concatdec.c:502: undefined reference to `av_bitstream_filter_filter'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dnxhddec.o): In function `dnxhd_probe':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dnxhddec.c:33: undefined reference to `avpriv_dnxhd_parse_header_prefix'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dtsdec.o): In function `dts_probe':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dtsdec.c:72: undefined reference to `avpriv_dca_convert_bitstream'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dtsdec.c:89: undefined reference to `avpriv_dca_sample_rates'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dv.o): In function `dv_frame_offset':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dv.c:425: undefined reference to `av_dv_codec_profile2'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dv.o): In function `dv_read_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dv.c:529: undefined reference to `av_dv_frame_profile'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(dv.o): In function `avpriv_dv_produce_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/dv.c:375: undefined reference to `av_dv_frame_profile'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(flacdec.o): In function `flac_read_timestamp':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/flacdec.c:251: undefined reference to `av_parser_init'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/flacdec.c:266: undefined reference to `av_parser_parse2'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/flacdec.c:282: undefined reference to `av_parser_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(http.o): In function `http_close':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/http.c:1424: undefined reference to `inflateEnd'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(http.o): In function `parse_content_encoding':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/http.c:626: undefined reference to `inflateEnd'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/http.c:627: undefined reference to `inflateInit2_'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/http.c:632: undefined reference to `zlibCompileFlags'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(http.o): In function `http_buf_read_compressed':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/http.c:1209: undefined reference to `inflate'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(id3v2.o): In function `id3v2_parse':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/id3v2.c:963: undefined reference to `uncompress'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(isom.o): In function `ff_mp4_read_dec_config_descr':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/isom.c:493: undefined reference to `avpriv_mpeg4audio_get_config'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/isom.c:497: undefined reference to `avpriv_mpa_freq_tab'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(latmenc.o): In function `latm_decode_extradata':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:63: undefined reference to `avpriv_mpeg4audio_get_config'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(latmenc.o): In function `latm_write_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:197: undefined reference to `avpriv_copy_bits'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:199: undefined reference to `avpriv_align_put_bits'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(latmenc.o): In function `latm_write_frame_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:123: undefined reference to `avpriv_copy_bits'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:130: undefined reference to `avpriv_copy_pce_data'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:119: undefined reference to `avpriv_copy_bits'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(latmenc.o): In function `latm_write_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/latmenc.c:195: undefined reference to `avpriv_copy_bits'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(matroskadec.o): In function `matroska_decode_buffer':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1294: undefined reference to `inflateInit_'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1309: undefined reference to `inflate'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1312: undefined reference to `inflateEnd'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1327: undefined reference to `BZ2_bzDecompressInit'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1342: undefined reference to `BZ2_bzDecompress'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1345: undefined reference to `BZ2_bzDecompressEnd'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1302: undefined reference to `inflateEnd'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1335: undefined reference to `BZ2_bzDecompressEnd'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(matroskadec.o): In function `matroska_aac_sri':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(matroskadec.o):/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/matroskadec.c:1616: more undefined references to `avpriv_mpeg4audio_sample_rates' follow
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mov.o): In function `mov_read_cmov':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mov.c:3807: undefined reference to `uncompress'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mov.o): In function `mov_read_dac3':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mov.c:744: undefined reference to `avpriv_ac3_channel_layout_tab'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mov.o): In function `mov_read_dec3':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mov.c:779: undefined reference to `avpriv_ac3_channel_layout_tab'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3dec.o): In function `mp3_read_probe':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:85: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3dec.o): In function `check':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:438: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:438: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:438: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3dec.o): In function `mp3_parse_vbr_tags':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:303: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3dec.o):/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3dec.c:438: more undefined references to `avpriv_mpegaudio_decode_header' follow
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3enc.o): In function `mp3_write_xing':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:149: undefined reference to `avpriv_mpa_freq_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:149: undefined reference to `avpriv_mpa_freq_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:149: undefined reference to `avpriv_mpa_freq_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3enc.o):/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:179: more undefined references to `avpriv_mpa_bitrate_tab' follow
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mp3enc.o): In function `mp3_write_xing':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mp3enc.c:195: undefined reference to `avpriv_mpegaudio_decode_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(mxfenc.o): In function `mxf_parse_dnxhd_frame':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mxfenc.c:1677: undefined reference to `avpriv_dnxhd_get_frame_size'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/mxfenc.c:1679: undefined reference to `avpriv_dnxhd_get_interlaced'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(nutenc.o): In function `find_expected_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/nutenc.c:73: undefined reference to `avpriv_mpa_freq_tab'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/nutenc.c:76: undefined reference to `avpriv_mpa_bitrate_tab'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggenc.o): In function `ogg_write_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggenc.c:517: undefined reference to `avpriv_split_xiph_headers'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggparsedirac.o): In function `dirac_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsedirac.c:40: undefined reference to `av_dirac_parse_sequence_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggparseflac.o): In function `old_flac_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparseflac.c:86: undefined reference to `av_parser_init'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparseflac.c:97: undefined reference to `av_parser_parse2'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparseflac.c:101: undefined reference to `av_parser_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggparsevorbis.o): In function `vorbis_cleanup':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:257: undefined reference to `av_vorbis_parse_free'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggparsevorbis.o): In function `vorbis_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:421: undefined reference to `av_vorbis_parse_reset'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:424: undefined reference to `av_vorbis_parse_frame_flags'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:436: undefined reference to `av_vorbis_parse_frame_flags'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:461: undefined reference to `av_vorbis_parse_reset'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:466: undefined reference to `av_vorbis_parse_frame_flags'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(oggparsevorbis.o): In function `vorbis_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/oggparsevorbis.c:391: undefined reference to `av_vorbis_parse_init'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(rtmpproto.o): In function `rtmp_uncompress_swfplayer':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtmpproto.c:1077: undefined reference to `inflateInit_'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtmpproto.c:1087: undefined reference to `inflate'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtmpproto.c:1105: undefined reference to `inflateEnd'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(rtpdec_jpeg.o): In function `jpeg_create_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:147: undefined reference to `avpriv_mjpeg_val_dc'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:147: undefined reference to `avpriv_mjpeg_bits_dc_luminance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:149: undefined reference to `avpriv_mjpeg_val_dc'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:149: undefined reference to `avpriv_mjpeg_bits_dc_chrominance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:151: undefined reference to `avpriv_mjpeg_val_ac_luminance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:151: undefined reference to `avpriv_mjpeg_bits_ac_luminance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:153: undefined reference to `avpriv_mjpeg_val_ac_chrominance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpdec_jpeg.c:153: undefined reference to `avpriv_mjpeg_bits_ac_chrominance'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(rtpenc_jpeg.o): In function `ff_rtp_send_jpeg':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:104: undefined reference to `avpriv_mjpeg_bits_dc_luminance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:105: undefined reference to `avpriv_mjpeg_val_dc'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:140: undefined reference to `avpriv_mjpeg_bits_ac_chrominance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:141: undefined reference to `avpriv_mjpeg_val_ac_chrominance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:116: undefined reference to `avpriv_mjpeg_bits_dc_chrominance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:117: undefined reference to `avpriv_mjpeg_val_dc'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:128: undefined reference to `avpriv_mjpeg_bits_ac_luminance'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/rtpenc_jpeg.c:129: undefined reference to `avpriv_mjpeg_val_ac_luminance'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(sdp.o): In function `xiph_extradata2config':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:367: undefined reference to `avpriv_split_xiph_headers'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(sdp.o): In function `latm_context2config':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: undefined reference to `avpriv_mpeg4audio_sample_rates'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(sdp.o):/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/sdp.c:457: more undefined references to `avpriv_mpeg4audio_sample_rates' follow
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(spdifdec.o): In function `spdif_get_offset_and_codec':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/spdifdec.c:60: undefined reference to `avpriv_aac_parse_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(spdifenc.o): In function `spdif_header_aac':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/spdifenc.c:357: undefined reference to `avpriv_aac_parse_header'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(spdifenc.o): In function `spdif_header_dts':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/spdifenc.c:258: undefined reference to `avpriv_dca_sample_rates'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(takdec.o): In function `tak_read_header':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/takdec.c:145: undefined reference to `avpriv_tak_parse_streaminfo'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(tee.o): In function `close_slaves':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/tee.c:327: undefined reference to `av_bitstream_filter_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(tee.o): In function `parse_bsfs':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/tee.c:115: undefined reference to `av_bitstream_filter_init'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(tee.o): In function `close_slaves':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/tee.c:327: undefined reference to `av_bitstream_filter_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(udp.o): In function `udp_close':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/udp.c:974: undefined reference to `pthread_cancel'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/udp.c:975: undefined reference to `pthread_join'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(udp.o): In function `udp_open':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/udp.c:847: undefined reference to `pthread_create'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(utils.o): In function `free_stream':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:3710: undefined reference to `av_parser_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(utils.o): In function `has_decode_delay_been_guessed':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:863: undefined reference to `avpriv_h264_has_num_reorder_frames'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:863: undefined reference to `avpriv_h264_has_num_reorder_frames'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:863: undefined reference to `avpriv_h264_has_num_reorder_frames'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(utils.o): In function `parse_packet':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:1257: undefined reference to `av_parser_parse2'
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:1318: undefined reference to `av_parser_close'
/home/codeDev/ffmpeg_sources/build_Mar-10-2016/lib/libavformat.a(utils.o): In function `ff_read_frame_flush':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavformat/utils.c:1669: /lib/libavutil.a(time.o): In function `av_gettime_relative':
/home/codeDev/ffmpeg_sources/ffmpeg-3.0/libavutil/time.c:60: undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
答案 2 :(得分:1)
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css'
}),
...(prod ? [] : [new BundleAnalyzerPlugin()])
],
答案 3 :(得分:1)
plugins: [
new ExtractTextPlugin('styles.css'),
(TARGET === 'build') && new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
drop_console: true,
}),
].filter(Boolean)
答案 4 :(得分:0)
我认为最干净的方法是设置多个构建。如果您的webpack.config.js
导出一组配置对象而不是单个对象,webpack将自动为每个对象执行构建。我有几个不同的构建,所以我将配置共享为变量,循环构建之间不同的因素,并在循环中使用条件来检查它是哪个构建。例如:
let allConfigs = [];
let buildTypes = ['dev', 'optimized'];
buildTypes.forEach( (type) => {
let buildConfig = {};
// ... other config
buildConfig.plugins = [];
if (type === 'optimized') {
// add Uglify to plugins array
}
// ...other config
allConfigs.push(buildConfig);
});
答案 5 :(得分:0)
您可以拥有一个基于另一个的webpack配置,并在后者中添加一些插件(和/或更改输出名称等):
此 webpack.release.config.js 使用 webpack.config (开发版),但使用了更多插件......
process.env.NODE_ENV = 'release';
const config = require('./webpack.config'),
webpack = require('webpack');
config.output.filename = 'app.min.js';
// use another plugin, compare to the basic version ←←←
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
minimize: true
}));
module.exports = config;
还有see here的完整示例。
答案 6 :(得分:0)
您可以在webpack中使用mode参数将var cameraPostion = new THREE.Vector3();
var cameraDirection = new THREE.Vector3();
camera.getWorldPosition(cameraPostion);
camera.getWorldDirection(cameraDirection);
raycaster.set( cameraPostion, cameraDirection );
/ development
的值传递给webpack配置,然后有条件地加载插件。
NPM脚本:
production
webpack.config.js:
"start": "webpack --watch --mode=development",
"build": "webpack --mode=production",
答案 7 :(得分:0)
您可以使用noop-webpack-plugin(noop表示无操作):
const isProd = process.env.NODE_ENV === 'production';
const noop = require('noop-webpack-plugin');
// ...
plugins: [
isProd ? new Plugin() : noop(),
]
或者没有其他模块的更好/推荐的解决方案:
const isProd = process.env.NODE_ENV === 'production';
// ...
plugins: [
isProd ? new Plugin() : false,
].filter(Boolean)
// filter(Boolean) removes items from plugins array which evaluate to
// false (so you can use e.g. 0 instead of false: `new Plugin() : 0`)