expose-webpack-module
expose webpack production code module
Last updated 10 months ago by 15000621931 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install expose-webpack-module 
SYNC missed versions from official npm registry.

expose-webpack-module

An expose function implemented by AST (Syntax Abstract Tree) that modifies the webpack production code to return its running results.

image

install

npm i expose-webpack-module --save

example

./test/index.js

import expose from "expose-webpack-module"
const source = "some code like ./test/source.js"
const target = expose(source)

with inject-content-webpack-plugin

plugins: [
    new InjectPlugin({
        inject: expose
    })
]

Last but not least !!!

After reading the html-webpack-plugin source code, I learned to use LibraryTemplatePlugin to solve this problem

// webpack.config.js
plugins: [
	new LibraryTemplatePlugin('HTML_WEBPACK_PLUGIN_RESULT', 'var'),
    new InjectPlugin({
        inject: source => source.replace('var HTML_WEBPACK_PLUGIN_RESULT =', '')
    })
]

Current Tags

  • 1.0.3                                ...           latest (10 months ago)

4 Versions

  • 1.0.3                                ...           10 months ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (5)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |