Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack works well with vizmake process #10

Closed
lindsayplatt opened this issue Jun 22, 2018 · 1 comment
Closed

webpack works well with vizmake process #10

lindsayplatt opened this issue Jun 22, 2018 · 1 comment

Comments

@lindsayplatt
Copy link

lindsayplatt commented Jun 22, 2018

PR #6 makes everything happen, BUT you have to run unpublish() and then vizmake() to get webpack to re-bundle the js modules if you edit anything since they are not a target.

We could...

  1. make every js module a target in viz.yaml and have the bundle publish step depend on each one.
  2. re-run the webpack bundle step every time vizmake is called no matter what
  3. work webpack into vizmake function

Potential things for number 3:


parameters:
  -
    id: webpack_input_js
    location: src/app.js
  -
    id: webpack_output_js
    location: bundle.js
  -
    id: webpack_module_dir
    dir: src/modules/
...

publish:
  - 
    id: js_bundle # get appropriate script tag
    relpath: ??????
    mimetype: application/javascript
    depends: webpack_output_js
  -
    id: figure_section # need this so that d3 code gets run after d3 has been loaded
    template: layout/templates/main_fig.mustache
    publisher: section
    depends:
      script: js_bundle
    context: 
      script: script
  -
    id: webpack_config
    template: webpack_config.mustache
    publisher: ??????
    depends:
    	input: webpack_input_js
	output: webpack_output_js
	context:
		input: input
		output: output

---------- webpack_config.mustache ----------

const webpack = require("webpack");

module.exports = {
    entry: './{{input}}',
    output: {
        filename: './{{output}}'
    },
    plugins: [
      new webpack.ProvidePlugin({
          d3: 'd3'
      })
    ]
};

---------- vizmake() calls a function called webpacker() ----------

check to see if package.json existed. if not, run `npm init -y`
check to see if correct node_modules are installed. if not install them.
check to make sure webpack.config.js exists (throw error if it doesn't because that should come from publish step)
?? when does package-lock.json get created?

once everything else is published `npm run start`
@lindsayplatt
Copy link
Author

Right now this is functioning as I would expect with vizlab v0.3.8 or greater. Specific things can be created as new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant