Skip to content

Creates a json file from a JavaScript object during the Webpack Building Process

License

Notifications You must be signed in to change notification settings

wtho/emit-json-file-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm

Emit Json-File Webpack Plugin

Creates a json file from a JavaScript object during the Webpack Building Process.

Install

npm i -D emit-json-file-webpack-plugin

Usage

new EmitJsonFileWebpackPlugin([files])

A file looks like: { path: 'filePath', content: 'object' }

Name Details
path This file path will created inside the Output Directory
example: 'folder/file.txt'
content The JavaScript object to be formatted as JSON. The Plugin uses json-format internally to format the object.

Examples

const EmitJsonFileWebpackPlugin = require('emit-json-file-webpack-plugin')

const fileContent = {
    importantValueA: 'A',
    valueB: 'B'
}

module.exports = {
    ...
    plugins: [
        new EmitJsonFileWebpackPlugin([
            // {output}/folder/file.txt
            { path: 'folder/file.txt', content: fileContent },
        ])
    ]
}

About

Creates a json file from a JavaScript object during the Webpack Building Process

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published