2017-04-19 15 views
7

मैं webpack उपयोग कर रहा हूँ एक जिले फ़ोल्डर में js फ़ाइलें और उत्पादन concat करने के लिए। यह सब काम करने के लिए लगता है, लेकिन मेरी समस्या यह है कि मैं नहीं बल्कि सादे js फ़ाइलें और concat ले अतिरिक्त webpack बूटस्ट्रैप कोडwebpack - हटाने "webpackBootstrap" कोड

/******/ (function(modules) { // (/******/ (function(modules) { // webpackBootstrap)...... 

बिना सभी js फ़ाइलों concat करना चाहते हैं कि कोड को जोड़ने से webpack को रोकने के लिए वहाँ वैसे भी है उन्हें (जैसे घूंट-concat)।

+1

मैं के बाद से webpack निर्भरता काम करने के लिए कोड कहते हैं आपके सवाल का जवाब के बारे में यकीन नहीं है। webpack आप केवल वही फ़ाइलें concatting रहे हैं तो अधिक हो सकता है की तुलना में आप की जरूरत –

+2

Webpack यह न करने का एक विकल्प होना चाहिए :( – JCarlos

उत्तर

1

यह webpack-merge-and-include-globally का उपयोग कर सकता है।

const path = require('path'); 
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally'); 

module.exports = { 
    entry: './src/index.js', 
    output: { 
    filename: '[name]', 
    path: path.resolve(__dirname, 'dist'), 
    }, 
    plugins: [ 
    new MergeIntoSingleFilePlugin({ 
     "bundle.js": [ 
     path.resolve(__dirname, 'src/util.js'), 
     path.resolve(__dirname, 'src/index.js') 
     ], 
     "bundle.css": [ 
     path.resolve(__dirname, 'src/css/main.css'), 
     path.resolve(__dirname, 'src/css/local.css') 
     ] 
    }) 
    ] 
}; 

https://code.luasoftware.com/tutorials/webpack/merge-multiple-javascript-into-single-file-for-global-scope/#webpack-merge-and-include-globally

संबंधित मुद्दे