Using webpack to bundle a custom yeoman generator

340 views Asked by At

I'm relatively new to Node in general, including webpack and yeoman, so the solution might be simple.

I built a custom yeoman generator that generates html and wish to use the generator in a browser (so html can be generated client side in the browser). I figure webpack could help me solve this solution but I'm hitting some module dependency snags when trying to bundle the generator.

Specifically, I'm getting several errors in regards to missing fs modules and issues bundling json files. From my understanding, setting target: 'node' in the webpack.config.js file resolves the fs issue, but unfortunately since I''ll be using this bundle in the browser I have target' set to 'web'. As per the json errors, I'm trying to include json-loader like so:

module: {
    loaders: [
        { test: /\.json$/, loader: "json-loader" }
    ]
},

but forwhatever reason, json-loader cannot be resolved when webpack is run.

Any ideas for fixing either of the dependency issues?

0

There are 0 answers