GithubHelp home page GithubHelp logo

ardatan / meteor-webpack Goto Github PK

View Code? Open in Web Editor NEW
123.0 9.0 29.0 1.93 MB

https://medium.com/@ardatan/meteor-with-webpack-in-2018-faster-compilation-better-source-handling-benefit-from-bc5ccc5735ef

License: MIT License

JavaScript 98.28% Shell 1.72%
meteor webpack angular react vue atmosphere webpack-cli meteor-webpack modern-web hmr

meteor-webpack's Introduction

Meteor-Webpack

Blog Post : https://medium.com/@ardatan/meteor-with-webpack-in-2018-faster-compilation-better-source-handling-benefit-from-bc5ccc5735ef

Meteor-Webpack provides you a development environment that integrates modern web bundler Webpack, and modern perfect full-stack JavaScript framework Meteor.

You need just one atmosphere package to start; ardatan:webpack

This project includes some examples with popular Frontend frameworks and a compiler package that replaces Meteor's bundler with modern web project bundler Webpack. You have to create a webpack.config.js file that has the compilation configurations for both client and server code. You are to free to choose the directory structure in your project, Webpack will compile your project regarding to your entry definition.

Simple Migration

Feel free like you are working in a Webpack CLI

Meteor-Webpack would make you feel you are using Webpack CLI. Just use same cases in Webpack's own documentation.

Feel free like you are working in a regular Meteor environment as well

Meteor-Webpack can resolve any atmosphere packages and Meteor modules like you are using without Meteor-Webpack

Try our examples with your favorite Frontend framework

Why Webpack

  • Faster compilation thanks to Webpack good caching during compilation
  • ES2015 Modules support instead of loading modules on runtime like Meteor's bundle does in CommonJS way, because Meteor only converts ES2015 import syntax,import module from 'module',to CommonJS import syntax; const module = require('module').
  • Tree-shaking for smaller final production bundle
  • You can migrate your existing Webpack project to Meteor easily.
  • You can use your existing Webpack loaders and plugins without a great modification including the ones don't exist as an atmosphere package.
  • Hot Module Replacement without reloading in each compilation using Webpack Dev Middleware together with Meteor's connect-compatible HTTP Server
  • HMR is available for server-side code, so your re-compiled server-side code will be replaced in 'already running' server without restart. So, the recompilation of server-side code takes less time than regular Meteor bundler's.
  • Comparisons with other bundlers are explained here.

Comparison with other solutions in Meteor

Regular Meteor Bundler

Regular Meteor Bundler uses babel which tranpiles your ES2015 syntax to ES5 even imports to CommonJS which creates some limitation for you. For instance, you cannot use ES2015 modules, then you need to import UMD modules which would probably contain unused submodules of this module. Despite you can use atmosphere packages with Meteor-Webpack, you don't need to add extra atmosphere packages for sass, typescript and others' compilation. For an extra compiler such as sass, less and pug etc; you can just install necessary webpack loader plugins, and add them into webpack.config.js. Meteor-Webpack runs exactly same way with webpack-dev-server.

As in its documentation; meteor-client-bundler is a module bundler which will take a bunch of Atmosphere package and put them into a single module, so we can load Meteor's client scripts regardless of what framework we're using to run our server. But you cannot use this client bundle with Server Side Rendering, and you must have two different projects which run on two different servers. With Meteor-Webpack, you can extract webpack.config.js from Angular CLI, create-react-app and any other CLI tools', then easily use it with Meteor.

Before you start

  • Remove existing compiler packages; meteor remove ecmascript es5-shim static-html
  • If you are using Meteor entry points, you have to remove them from your package.json
"meteor": {
  "mainModule": {
    "client": "client/main.js",
    "server": "server/main.js"
  }
}
  • You have to install webpack and necessary plugins with your favorite package manager; yarn or npm
  • Add Meteor package webpack by the command meteor add ardatan:webpack
  • Create webpack.config.js, and define entry module which is necessary for webpack.
  • If you have seperate client and server codes, you have to declare two configurations like we have in our example.

Seperating Client and Server Configuration - IMPORTANT!

  • You have to add target field by node value in the configuration object you want to use as server's;
    const clientConfig = {
        //...
    }
    const serverConfig = {
        //...
        target: 'node',
    }

Meteor Package Imports - IMPORTANT!

  • If you are using Meteor's package imports such as import { Meteor } from 'meteor/meteor', import { Mongo } from 'meteor/mongo' and also non-global package references such as import { publishComposite } from 'meteor/reywood:publish-composite'. You have to install webpack-meteor-externals npm package, and add it to both client and server entries in webpack.config.js.
  • If you are using all of them by their global references without imports, you don't need that package.
    meteor npm install webpack-meteor-externals --save-dev
    const meteorExternals = require('webpack-meteor-externals');
    //...
    externals: [
        meteorExternals()
    ]
    //...

Meteor File Imports - Optional

  • If you have an existing meteor app and do not want to change the pathnames from '/imports/...' to relative paths, use the following in your webpack.config.js
    //...
    resolve: {
        modules: [
          path.resolve(__dirname, 'node_modules'),
          path.resolve(__dirname, './'), // enables you to use 'imports/...' instead of '/imports/...'
        ],
        alias: {
          '/imports': path.resolve(__dirname, './imports'),
          '/ui': path.resolve(__dirname, './ui'),
          // ... and any other directories you might have
        }
    }
    //...

Client Configuration

If you want to use Webpack's Development Server instead of Meteor's, you have to add devServer field in the client configuration;

    devServer: {}

then you have to add another atmosphere package to packages;

    meteor add ardatan:webpack-dev-middleware

NOTE Make sure ardatan:webpack-dev-middleware is at the bottom of your .packages list for the best compatibility with other Meteor packages.

don't forget to install webpack-dev-middleware package from NPM;

    meteor npm install webpack-dev-middleware --save-dev

Server Configuration

Loading NPM modules on runtime instead of compiling them by Meteor

  • Install webpack-node-externals
    meteor npm install webpack-node-externals --save-dev
  • Add externals into the server configuration in webpack.config.js
    externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
  • Process is the same with Webpack; so you have to just change your client and server configuration;

  • Add hot field for both client and server which is true,

    devServer: {
        hot: true
    }
  • and add the necessary plugin only for client; do not add this plugin for server, hot: true is enough for server-side HMR!
    plugins: {
        new webpack.HotModuleReplacementPlugin()
    }
  • Then install webpack-dev-middleware,

  • Install client-side HMR middleware webpack-hot-middleware in your project

  • Install server-side HMR middleware webpack-hot-server-middleware in your project

  • Meteor's bundler may restart your server which is not good for HMR's working process; so we need to disable it by adding .meteorignore on the root with the following content;

    *
    !.meteor/
    !node_modules/
    !webpack.config.js

meteor/server-render

  • Meteor's server-render will work as expected if you use webpack to include HTML via HtmlWebpackPlugin. Important: Be sure that server-render is listed BELOW webpack-dev-server in meteor/packages

Dynamic boilerplate assets

  • You can use WebAppInternals.registerBoilerplateCallback to dynamically change the CSS and JS served to visitors via data.js and data.css. In order to use this feature with webpack, you must set inject: false on HtmlWebpackPlugin and set the environment variable DYNAMIC_ASSETS=true.

Galaxy Deployment

meteor deploy command doesn't set NODE_ENV=production environment variable. That's why, webpack compiler recognizes that it is still a development build. You have two options to fix issue;

First option ( Recommended )

  • You have to provide GALAXY_NODE_OPTIONS=--production to make webpack recognize that it is a production build. or

Second option

  • Create a seperate configuration file for webpack which doesn't contain development settings such as devServer, and includes UglifyJs plugins. Then, set environment variable WEBPACK_CONFIG_FILE=<filename>.

Testing

  • Using meteor test requires the option --test-app-path $(pwd)/.meteortest. This will run the test inside the .meteortest directory in your project. Normally, meteor test runs a test version of the application inside your /tmp directory, but webpack needs to be able to access the project's node_modules folder.

  • You may also run into permissions issues after the .meteortest folder is created. I recommend adding rm -r .meteortest to the beginning of your test command.

  • All DDP connections are closed when the dev server recompiles in test mode. This will trigger testing libraries that use DDP (Chimpy) to re-run if they are in watch mode.

meteor-webpack's People

Contributors

abecks avatar angular-cli avatar ardatan avatar deadly0 avatar dependabot[bot] avatar filipenevola avatar grossbart avatar gustawdaniel avatar jamesgibson14 avatar nachocodoner avatar renovate-bot avatar s7dhansh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-webpack's Issues

Importing Blaze templates?

Hi. First of all, I'd like to thank you for making this package. I've searched far and wide and am so extremely grateful to have stumbled across this project when I did.

I'm new to Webpack having never used it before. How would one go about importing a Blaze template into the client entry point?

Importing the html file throws this error:

Uncaught Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <template name="App_body">

.babelrc ignored when upgrading babel to a version greater than 7

Hi 👋 👋

It's nice to see efforts to make an integration between meteor and webpack possible! On our company, we wanted to try this out, but we are getting some weird errors when updating babel to the latest version, and in fact, its the same problem as #22, but updating meteor and babel runtime did not solve in my case...

I have a reproducible repo at https://github.com/GabrielDuarteM/meteor-webpack-babel-error. It has basically 4 commits, the first being the exact clone of the example, second is bumping all npm packages besides the babel related ones, third is updating meteor and its packages, and fourth is after I ran npx babel-upgrade (the babel tool to update from version 6 to 7).

Up until the last commit (updating babel), everything was working fine (can be checked by running git reset HEAD^ --hard), but after it, I started getting the Unexpected token error on the <App />, typically suggesting that babel is not transpiling the React code. I tried renaming .babelrc to babel.config.js to see if it solves, but no luck on that. Also tried putting syntax errors inside the .babelrc, and the compiler didn't even complain, so I'd guess that the config is not being picked up at all.

Any idea of what it could be?

React example does not work

Since version 0.0.4_6 the React example renders nothing in the web browser (chrome).
The web server seems to work properly.

.babelrc Ignored With Babel 7.0.0-beta & babel-loader 8.0.0-beta

Steps to reproduce:

Clone and run: https://github.com/stolinski/meteor-webpack-test

You should be seeing an unexpected token error on the first < in jsx.

Same repo compiled fine with example versions of babel but after upgrading the .babelrc file is ignored. This doesn't seem to be a webpack issue though, because if you tell webpack to watch with webpack -w everything compiles correctly. The .babelrc file is only ignored when running meteor to build.

Uncaught TypeError: Cannot read property 'withTracker' of undefined

I'm using react with metoer example and the tracker is not working:
Uncaught TypeError: Cannot read property 'withTracker' of undefined
at Object.eval (App.jsx:161)
at eval (App.jsx:189)
at Object../client/ui/App.jsx (bundle.js:812)
at webpack_require (bundle.js:712)
at fn (bundle.js:95)
at eval (main.jsx:9)
at Object../client/main.jsx (bundle.js:788)
at webpack_require (bundle.js:712)
at bundle.js:764
at bundle.js:767

error: unknown package in top-level dependencies: ardatan:webpack-dev-middleware

Hello, I can't find this package ardatan:webpack-dev-middleware on atmospherejs
https://atmospherejs.com/?q=webpack-dev-middleware

I tried to run your React example and got this error:

[[[[[ ~/Documents/filipe/ws/meteor-webpack/examples/react ]]]]]

=> Started proxy.                             
=> Errors prevented startup:                  
   
   While selecting package versions:
   error: unknown package in top-level dependencies: ardatan:webpack-dev-middleware
   
=> Your application has errors. Waiting for file change.

Maybe you still have to publish it?

meteor bundle does not always work

After generating a meteor bundle using the command meteor build, the generated web uses to fail the first time I run the app in the browser. Then, after reloading the app pressing F5, the web works properly.
Every time I open a new web browser and load the bundle app, the described behaviour repeats (fails the first page load but after reload with F5 it works fine).
This behaviour has been observed in Windows 10, using the react example, both in chrome and firefox.
I have tried to run set GALAXY_NODE_OPTIONS=--production before running meteor build, but the problem remains the same.

Possible to build client side to static files, and run the meteor server side separately?

I would like to compile the client side to static files so that I can bundle them in a chrome extension. I would then like to run the meteor server on its own. I thought that this project would help me do this, but I am not sure how.

I can compile the react example with webpack by doing npx webpack --config webpack.config.js but running the index.html page gives me the error Uncaught ReferenceError: Package is not defined.

Error resolving module imports

Thanks for the interesting package!

I'm running into the following error:


ERROR in ./server/main.js
Module not found: Error: Can't resolve '/imports/startup/server' in '/Users/ali/Development/Meronex/Applications/Products/Meronex Communities/meronex-communities/server'
 @ ./server/main.js 1:0-33
 @ multi ./server/main.js

The ./server/main.js has the following line:

import '/imports/startup/server';

Any idea what might be causing this? I think it might be due to the absolute paths since in the examples we've relative paths.

'Meteor test' seems not working

I tried to test meteor with
meteor test --driver-package meteortesting:mocha --test-app-path $(pwd)/.meteortest

but it endlessly showed

I20190408-11:20:22.005(9)? --------------------------------
I20190408-11:20:22.006(9)? ----- RUNNING SERVER TESTS -----
I20190408-11:20:22.006(9)? --------------------------------
I20190408-11:20:22.006(9)? 
I20190408-11:20:22.006(9)? 
I20190408-11:20:22.006(9)? 
I20190408-11:20:22.007(9)?   0 passing (0ms)
I20190408-11:20:22.007(9)? 
I20190408-11:20:22.007(9)? Load the app in a browser to run client tests, or set the TEST_BROWSER_DRIVER environment variable. See https://github.com/meteortesting/meteor-mocha/blob/master/README.md#run-app-tests
=> Exited with code: 0

I currently installed meteor packages like

# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected]             # Packages every Meteor app needs to have
[email protected]       # Packages for a great mobile UX
[email protected]                   # The database Meteor supports right now
[email protected]            # Reactive variable for tracker
[email protected]                 # Meteor's client-side reactive programming library

[email protected]    # JS minifier run for production mode
[email protected]            # Server-side component of the `meteor shell` command

[email protected]                # Allow all DB writes from clients (for prototyping)
react-meteor-data       # React higher-order component for reactively tracking Meteor data
http
meteorhacks:[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
ardatan:webpack
ardatan:webpack-dev-middleware
accounts-ui
accounts-password
session
juliancwirko:postcss

I tried other meteor test driver like praticalmeteor but it didn't work. Should I change something?
I expect the web reporters view when I open localhost:3000

Cannot use `aldeed:schema-index`, getting error "index" is not a supported property

I'm having this issue with aldeed:schema-index although I think the same issue would apply also to other meteor packages. Basically what this package does is add several options to SimpleSchema.

SimpleSchema.extendOptions([
  'index', // one of Number, String, Boolean
  'unique', // Boolean
  'sparse', // Boolean
]);

The problem is that I'm getting the following error:

Error: Invalid definition for username field: "index" is not a supported property

I've tried to use your example of React by adding simple-schema and I'm getting the exact same error.
It seems like the meteor package is not executed or is using a different version of SimpleSchema.

Or maybe I missed something in how to actually use this package since I don't have much experience in meteor.

Accounts hooks broken after re-compilation

webpack-dev-server package handles methods and publications by keeping native ones and deleting rest, but Accounts hooks are not overwritten but duplicated in every re-compilation. So it causes accounts methods might become broken (login, resetPassword etc...). In this case, devServer can be removed in serverConfig as a workaround.
Accounts.validateLoginAttempt and Accounts.validateNewUser etc...

How To Run After Compilation

This might seem like a dumb question, but how do you run your site after compilation. Is the intention to run through webpack or through Meteor.

For clarification, I'm running webpack -w and things are compiling fine, but should I be then running meteor as well to fire up the server?

How to bundle meteor packages on a single file?

Hi,

First of all, thank you so much community and @ardatan for this awesome project, I really love DDP and that's all, I don't think MDG should build all stuff from scratch, but...

My question is if it's possible to bundle all meteor packages into a single bundle so I can work with chunks. Now my build has ~30 script files all coming from /packages/

image

Cannot read property 'getSourceHash' of undefined

Hi

When trying to make a production build using the following command
WEBPACK_CONFIG_FILE=\"webpack.prod.js\" meteor build --architecture=os.linux.x86_64 --allow-superuser --directory .build
I get the following error:

Errors prevented bundling:
While processing files with ardatan:webpack (for target web.browser):
packages/webpack_plugin.js:74:43: Cannot read property 'getSourceHash' of undefined (at Object.processFilesForTarget)

While processing files with ardatan:webpack (for target os.linux.x86_64):
packages/webpack_plugin.js:74:43: Cannot read property 'getSourceHash' of undefined (at Object.processFilesForTarget)

I assume its printing twice, one for each bundle, client/server

My webpack configs are pretty simple:

// webpack.common.js
const meteorExternals = require('webpack-meteor-externals');
const path = require('path');
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

module.exports = {
  devtool: 'cheap-module-source-map',
  resolve: {
    extensions: ['.json', '.js', '.jsx', '.ts', '.tsx'],
    alias: {
      tests: path.resolve(__dirname, 'tests'),
      '/imports': path.resolve(__dirname, 'imports'),
      imports: path.resolve(__dirname, 'imports'),
    },
    plugins: [
      new TsConfigPathsPlugin({
        configFile: path.resolve(__dirname, 'tsconfig.json'),
      }),
    ],
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: 'babel-loader?cacheDirectory',
        exclude: /node_modules/,
      },
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
  externals: [meteorExternals()],
};
// webpack.prod.js
const merge = require('webpack-merge');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');

const webpackCommon = require('./webpack.common');

const clientConfig = merge(webpackCommon, {
  devtool: 'sourcemap',
  entry: [path.resolve(__dirname, 'client', 'main')],
  mode: 'production',
  module: {
    rules: [
      {
        test: /\.scss/,
        use: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /\.css/,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './client/main.html',
    }),
    new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
  ],
});

const serverConfig = merge(webpackCommon, {
  devtool: 'sourcemap',
  mode: 'production',
  entry: path.resolve(__dirname, 'server'),
  target: 'node',
});

module.exports = [clientConfig, serverConfig];

Error: Meteor code must always run within a Fiber

I get this error when I use Meteor.user() inside withTracker functions, only on server.

Error running template: Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment. 

It happens at this line in the react-meteor-data package: https://github.com/meteor/react-packages/blob/796a075a4bbb36212e6a74c9f3576b119d31c474/packages/react-meteor-data/ReactMeteorData.jsx#L34

Meteor.bindEnvironment can't be used because it eats up the return values.

Any ideas for solving this?

This repo is 🔥

Thanks so much for the repo @ardatan. This is huge for my application development. If you need any help maintaining this, please let me know. I can help with code or docs etc. 💥

How to watch for changes of static files?

I have some static HTML files in /public - if I change a file, and reload the browser, the file is not updated. I need to restart the server or a bundle rebuild to get the new version.

I tried without success:

    devServer: {
      contentBase: ['./dist', './public'],
      watchContentBase: true,
      hot: true
    },

DevServer does not restore Accounts hooks and settings

I have currently an issue with the dev-server. While using it, it looks like the Accounts hooks and options are getting cleaned but not restored correctly.'

E.g. when setting a breakpoint in Meteor.startup Accounts._options has values. However afterwards they get cleaned and results in Accounts._options = {} the validateNewUser hook is also removed.

Maybe related to Issue #15?

packages:

# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected]             # Packages every Meteor app needs to have
[email protected]       # Packages for a great mobile UX
[email protected]                   # The database Meteor supports right now
[email protected]            # Reactive variable for tracker

[email protected]   # CSS minifier run for production mode
[email protected]    # JS minifier run for production mode
[email protected]            # Server-side component of the `meteor shell` command

react-meteor-data       # React higher-order component for reactively tracking Meteor data
tracker
universe:i18n
mdg:validated-method
accounts-password
email
meteortesting:mocha
kit:basic-auth
fourseven:scss
http
ardatan:webpack
ardatan:webpack-dev-middleware

package.json:

{
  "name": "xys",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "rm -fr .meteortest",
    "test-app": "TEST_WATCH=1 meteor test --full-app --test-app-path $(pwd)/.meteortest --once --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer",
    "lint": "eslint . --fix",
    "pretest": "npm run lint --silent",
    "build": "webpack"
  },
  "pre-commit": "lint",
  "dependencies": {
    "@babel/polyfill": "^7.4.4",
    "@babel/runtime": "^7.4.5",
    "@fortawesome/fontawesome-svg-core": "^1.2.18",
    "@fortawesome/free-brands-svg-icons": "^5.8.2",
    "@fortawesome/free-regular-svg-icons": "^5.8.2",
    "@fortawesome/free-solid-svg-icons": "^5.8.2",
    "@fortawesome/react-fontawesome": "^0.1.4",
    "animate.css": "^3.7.0",
    "bcrypt": "^3.0.6",
    "bootstrap": "^4.3.1",
    "formik": "^1.5.7",
    "history": "^4.7.2",
    "jquery": "^3.4.1",
    "js-md5": "^0.7.3",
    "meteor-node-stubs": "^0.4.1",
    "popper.js": "^1.14.6",
    "prop-types": "^15.6.2",
    "query-string": "^5.1.1",
    "react": "^16.7.0",
    "react-bootstrap": "^1.0.0-beta.8",
    "react-cookie-consent": "^2.3.1",
    "react-dom": "^16.7.0",
    "react-ga": "^2.5.7",
    "react-router": "^5.0.0",
    "react-router-dom": "^5.0.0",
    "react-toastify": "^5.1.1",
    "simpl-schema": "^1.5.5",
    "yup": "^0.27.0"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/plugin-proposal-class-properties": "^7.4.4",
    "@babel/plugin-syntax-jsx": "^7.2.0",
    "@babel/plugin-transform-react-display-name": "^7.2.0",
    "@babel/plugin-transform-react-jsx": "^7.3.0",
    "@babel/plugin-transform-react-jsx-self": "^7.2.0",
    "@babel/plugin-transform-react-jsx-source": "^7.2.0",
    "@babel/preset-env": "^7.4.5",
    "@babel/preset-react": "^7.0.0",
    "@meteorjs/eslint-config-meteor": "^1.0.5",
    "autoprefixer": "^9.5.1",
    "babel-eslint": "^10.0.1",
    "babel-loader": "^8.0.6",
    "css-loader": "^2.1.1",
    "eslint": "^5.16.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-import-resolver-meteor": "^0.4.0",
    "eslint-loader": "^2.1.2",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-jsx-a11y": "^6.2.0",
    "eslint-plugin-meteor": "^5.1.0",
    "eslint-plugin-react": "^7.13.0",
    "file-loader": "^3.0.1",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "node-sass": "^4.12.0",
    "postcss-loader": "^3.0.0",
    "precss": "^4.0.0",
    "react-hot-loader": "^4.8.8",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "webpack": "^4.32.2",
    "webpack-cli": "^3.3.2",
    "webpack-dev-middleware": "^3.7.0",
    "webpack-hot-middleware": "^2.25.0",
    "webpack-hot-server-middleware": "^0.6.0",
    "webpack-meteor-externals": "0.0.5",
    "webpack-node-externals": "^1.7.2"
  },
  "eslintConfig": {
    "extends": "@meteorjs/eslint-config-meteor"
  }
}

webpack.config.js:

const HtmlWebpackPlugin = require('html-webpack-plugin');
const meteorExternals = require('webpack-meteor-externals');
const nodeExternals = require('webpack-node-externals');
const precss = require('precss');
const autoprefixer = require('autoprefixer');

const clientConfig = {
  mode: 'development',
  devtool: 'eval-source-map',
  devServer: {
    hot: true,
  },
  entry: ['@babel/polyfill', './client/main.js'],
  output: {
    publicPath: '/',
    filename: 'bundle.js',
  },
  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.js$/,
        exclude: /node_modules/,
        use: ['eslint-loader'],
      },
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env', '@babel/preset-react'],
              plugins: ['@babel/plugin-proposal-class-properties'],
            },
          },
        ],
      },
      {
        test: /\.(scss|css)$/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins() {
                return [
                  precss,
                  autoprefixer,
                ];
              },
            },
          },
          {
            loader: 'sass-loader',
          },
        ],
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/,
        use: [
          {
            loader: 'file-loader',
            options: {},
          },
        ],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './client/main.html',
      favicon: './client/favicon.png',
    }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  resolve: {
    extensions: [
      '*', '.js', '.jsx',
    ],
  },
  externals: [
    meteorExternals(),
  ],
};

const serverConfig = {
  mode: 'development',
  devtool: 'eval-source-map',
  devServer: {
    hot: true,
  },
  entry: [
    './server/main.js',
  ],
  target: 'node',
  externals: [
    nodeExternals(),
    meteorExternals(),
  ],
};

module.exports = [clientConfig, serverConfig];

dynamicImport not work in vue router

hello.
happy new year.

my bug:

router.js:1 Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: E:\Meteor\webpack\vuetify\imports\FrontEnd\router.js: Support for the experimental syntax 'dynamicImport' isn't currently enabled (1:21):

1 | const Index = () => import('./Main.vue');
| ^
2 | const Home = () => import('./Home.vue');
3 | const Content = () => import('./Content.vue');
4 | const Category = () => import('./Category.vue');

Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the 'plugins' section of your Babel config to enable parsing.

my code:

const Index = () => import('./Main.vue');
const Home = () => import('./Home.vue');
const Content = () => import('./Content.vue');
const Category = () => import('./Category.vue');
const routes = [
{
path : '/',
component: Index,
children : [
{path: '', component: Home},
{path: 'home', component: Home},
{path: 'category-:id-:slug', component: Category},
{path: 'content-:id-:slug', component: Content},
{path: 'link', component: Category},
]
}
];
export default routes;

and i installed this and add plugin to .babelrc but not work :
https://babeljs.io/docs/en/next/babel-plugin-syntax-dynamic-import.html

Problem with some libraries and @babel/runtime

Hello, I'm trying to run a small/medium size app and for that I need to start to use .jsx files (I was using only .js files) and I had to only use relative imports (I was using /imports sometimes) but even with these changes I'm not able to run my project yet.

I'm having errors with material ui icons and react tunnels, I think webpack is not loading those, the icons can be because of svg extension but react tunnels I have no idea.

from material-ui-icons

ERROR in ./imports/core/person/personStatuses.jsx
Module parse failed: Unexpected token (6:17)
You may need an appropriate loader to handle this file type.
| import { default as SentimentSatisfied } from 'material-ui-icons/SentimentSatisfied';
| 
| const goodIcon = <SentimentSatisfied className="person-good" />;
| const neutralIcon = <SentimentNeutral className="person-neutral" />;
| const badIcon = <SentimentDissatisfied className="person-bad" />;
 @ ./imports/core/systematic/systematic.js 19:0-62 159:12-26
 @ ./imports/collections/PeopleCollection.js
 @ ./imports/resolvers.js
 @ ./server/main.js
 @ multi ./server/main.js

from tunnel:

ERROR in ./imports/ui/components/uis.jsx
Module parse failed: Unexpected token (38:9)
You may need an appropriate loader to handle this file type.
|     document.title = title ? `${title} | bemarke` : 'bemarke';
|   }
|   return <Tunnel id="app-title">{title || 'bemarke'}</Tunnel>;
| };
| 
 @ ./imports/core/scheduleOptions.js 3:0-79 124:7-42
 @ ./imports/collections/ActivitiesCollection.js
 @ ./imports/resolvers.js
 @ ./server/main.js
 @ multi ./server/main.js

I'm also having this error:

W20180329-15:52:29.677(-3)? (STDERR) /home/filipe/Documents/quave/ws/bemarke/.meteor/local/build/programs/server/boot.js:475
W20180329-15:52:29.678(-3)? (STDERR) }).run();
W20180329-15:52:29.678(-3)? (STDERR)    ^
W20180329-15:52:29.678(-3)? (STDERR) 
W20180329-15:52:29.678(-3)? (STDERR) Error: Cannot find module '@babel/runtime/helpers/builtin/objectSpread'
W20180329-15:52:29.678(-3)? (STDERR)     at Function.Module._resolveFilename (module.js:538:15)
W20180329-15:52:29.679(-3)? (STDERR)     at Function.resolve (internal/module.js:18:19)
W20180329-15:52:29.679(-3)? (STDERR)     at Object.require (/home/filipe/Documents/quave/ws/bemarke/.meteor/local/build/programs/server/boot.js:288:32)
W20180329-15:52:29.679(-3)? (STDERR)     at makeInstallerOptions.fallback (packages/modules-runtime.js:651:18)
W20180329-15:52:29.679(-3)? (STDERR)     at require (packages/modules-runtime.js:244:16)
W20180329-15:52:29.679(-3)? (STDERR)     at livedata_connection.js (/home/filipe/Documents/quave/ws/bemarke/.meteor/local/build/programs/server/packages/ddp-client.js:149:45)
W20180329-15:52:29.679(-3)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:343:9)
W20180329-15:52:29.680(-3)? (STDERR)     at require (packages/modules-runtime.js:238:16)
W20180329-15:52:29.680(-3)? (STDERR)     at namespace.js (packages/ddp-client/common/namespace.js:1:300)
W20180329-15:52:29.680(-3)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:343:9)
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

Do you know why? Any thing that I can do to improve it? I think in this case the problem is with Webpack and not with your package but maybe you can help me 😄

react-dom included twice?

When I run meteor --extra-packages bundle-visualizer --production I see react-dom.production.min.js (106kb) included and an extra main.bundle.js (599kb). When I run
webpack-bundle-analyzer stats.json dist I get what the main bundle (here 589kb) is made of, included is react-dom.production.min.js (103kb).

How can I find out where the duplicate comes from? Imho the meteor bundler should not include it.

Working with tests?

I love the DX of using webpack here, but I can no longer run my tests with the meteor test command. I'd been using the meteortesting:mocha driver for 6 months without issue until I changed to using webpack. Now I get the error:

Error: Cannot find module '/private/var/folders/3h/cm6yv0bs7xb_7h0_47p_w36h0000gn/T/meteor-test-run1qy5334.dlt1k/node_modules/webpack'

Any ideas how to get this up and running again? I'm happy to contribute if you point me in the right direction!

meteor android app

I tried the react demo with meteor run android
it says

I20190510-23:35:40.409(2)? 05-10 23:35:24.782 4214 4214 I chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token <", source: http://localhost:12296/app.js (1)

Javascript heap out of memory error

Hey, I am getting the following error when trying to use HMR on my current bundle:

I20190803-12:24:37.784(-7)? <--- Last few GCs --->
I20190803-12:24:37.785(-7)? 
I20190803-12:24:37.785(-7)? [13338:0x103000000]   277033 ms: Mark-sweep 1108.0 (1434.0) -> 1107.3 (1435.5) MB, 735.8 / 0.1 ms  allocation failure GC in old space requested
I20190803-12:24:37.785(-7)? [13338:0x103000000]   277790 ms: Mark-sweep 1107.3 (1435.5) -> 1106.7 (1380.5) MB, 756.9 / 0.0 ms  last resort GC in old space requested
I20190803-12:24:37.785(-7)? [13338:0x103000000]   278537 ms: Mark-sweep 1106.7 (1380.5) -> 1106.7 (1362.0) MB, 747.0 / 0.0 ms  last resort GC in old space requested
I20190803-12:24:37.785(-7)? 
I20190803-12:24:37.786(-7)? 
I20190803-12:24:37.786(-7)? <--- JS stacktrace --->
I20190803-12:24:37.786(-7)? 
I20190803-12:24:37.786(-7)? ==== JS stack trace =========================================
I20190803-12:24:37.786(-7)? 
I20190803-12:24:37.786(-7)? Security context: 0x389b5caa58b9 <JSObject>
I20190803-12:24:37.787(-7)?     1: stringSlice(aka stringSlice) [buffer.js:560] [bytecode=0x389bfcccb989 offset=94](this=0x389b7ae822d1 <undefined>,buf=0x389bbb5bf7c9 <Uint8Array map = 0x389ba594bd11>,encoding=0x389b5cab5b89 <String[4]: utf8>,start=0,end=45220306)
I20190803-12:24:37.787(-7)?     2: toString [buffer.js:~609] [pc=0x16fea1251e2](this=0x389bbb5bf7c9 <Uint8Array map = 0x389ba594bd11>,encoding=0x389b5cab5b89 <String[4]: utf8>,start=0x389b7...
I20190803-12:24:37.787(-7)? 
W20190803-12:24:37.792(-7)? (STDERR) FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I have experience with this error and usually fix it by setting the environment variables TOOL_NODE_FLAGS and NODE_OPTIONS, but it appears that neither of them gets properly passed through to the webpack node instance.

Is there any way to properly pass through those environment variables?

dynamic import at top level fails

A)

async function main() {
	const [
		React,
		{hydrate},
	] = await Promise.all([
		import('react'),
		import('react-dom'),
	]);

	hydrate(<div>asdfasdf</div>, document.getElementById('root'));
}

main();

fails with an error:

Uncaught ReferenceError: exports is not defined
    at 0.js:1
(anonymous) @ 0.js:1
app.js:817 Uncaught (in promise) Error: Loading chunk 0 failed.

If I remove the Promises, it works:
B)

import React from 'react';
import {hydrate} from 'react-dom';
hydrate(<div>asdfasdf</div>, document.getElementById('root'));

Ironically enough, if I replace (B) with (A) now (while meteor is running), the app starts working. It fails again when I restart meteor. Can someone guide me on fixing/debugging this?

Bug while importing packages with lazy loading

I have configured webpack and it works well, but when i try to import jagi:astronomy empty object is the result of the import. At the same time i can import reywood:publish-composite and other packages. Example

import astronomy  from 'meteor/jagi:astronomy';
import { publishComposite } from 'meteor/reywood:publish-composite';

console.log(astronomy, publishComposite); // print:  {} [Function: publishComposite]

Any ideas why it happened and how to fix it
Thx!

Zero configuration support

This package should support the scenerio when the project doesn't include any webpack.config, it should automatically generate a configuration file for webpack in order to support zero-configuration like Meteor aims.

Examples are not working after new release

The examples are not working,

39328339-5b51657e-499b-11e8-98d5-57419f4f74f1

I could make it work by updating webpack and related packages to their latest version but then this error is thrown:

screenshot from 2018-04-28 22-17-36 1

There are several points that should help us encounter the problem:

  1. This error is thrown only when your server recompiles after the inital compile
  2. Check out Meteor.default_server.method_handlers (on the server), you will see that it doesn't include methods that are set by meteor's packages (like accounts-password for example).
  3. The problem didn't exist before introuducing HMR on the server.

any ideas?

Update:

I found the problem here.

// webpack-dev-middleare/dev-server

Meteor.server.method_handlers = {};
Meteor.server.publish_handlers = {};

Those two lines were basically deleting any handlers set by packages outside of our code.

I'm not sure why they exists so iv'e created a pull request (#10) that keeps them there but make sure they are not overwriting anything important.

HMR is working but not always

Hello, I'm testing HMR with your react example project, on Chrome.

It's working the first time and after it stops to work then I need to refresh the page (reload), sometimes even it is not making my changes appear then I need to clean the storage of the application because even with server restart it continues to show the same content.

Are you experiencing this too? Have you tested it in a bigger application? How can I help?

Should I be able to use Meteor mainModule configuration with meteor-webpack?

Hello, I tried to add Meteor mainModule configuration in the package.json to not use the imports folder but my main modules were not found on startup.

Should I be able to use Meteor mainModule with meteor-webpack?

You can see the problem here running meteor as usual.
https://github.com/filipenevola/wantch/tree/meteor-main-module

If you want I can create a reproduction here in the React example but this code was copied from there.

The error that I got is below

=> Errors prevented startup:
   
   While building the application:
   error: Could not find mainModule for 'os' architecture:
   startup/server/main.js
   Check the "meteor" section of your package.json file?
   error: Could not find mainModule for 'web.browser' architecture:
   startup/client/main.js
   Check the "meteor" section of your package.json file?
   error: Could not find mainModule for 'web.browser.legacy' architecture:
   startup/client/main.js
   Check the "meteor" section of your package.json file?
   
=> Your application has errors. Waiting for file change.

Has anyone dealt with nested imports?

Working on migrating a meteor 1.7 app to use webpack but I keep getting the nested imports error. Has anyone dealt with this and if so what did you do? Most of the imports are wrapped in Meteor.isServer blocks.

Meteor Packages Undefined When Using Yarn in React Example

Not sure if this is an issue with the React example in the repo or with the lib.
Steps to reproduce.

  1. Clone Repo
  2. cd in to examples/react
  3. yarn
  4. meteor

Seeing lots of things as undefined

Uncaught TypeError: _this._launchConnection is not a function
    at new ClientStream (browser.js:46)
    at new Connection (livedata_connection.js:86)
    at Object.DDP.connect (namespace.js:64)
    at client_convenience.js (client_convenience.js:48)
    at fileEvaluate (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353)
    at require (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248)
    at client.js (client.js:1)
    at fileEvaluate (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353)
    at require (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248)
    at ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:2381
ClientStream @ browser.js:46
Connection @ livedata_connection.js:86
DDP.connect @ namespace.js:64
client_convenience.js @ client_convenience.js:48
fileEvaluate @ modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353
require @ modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248
client.js @ client.js:1
fileEvaluate @ modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353
require @ modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248
(anonymous) @ ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:2381
(anonymous) @ ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:2388
ddp.js?hash=dae39f35e2956c6df4d8b9963eea38371d546176:14 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at ddp.js?hash=dae39f35e2956c6df4d8b9963eea38371d546176:14
    at ddp.js?hash=dae39f35e2956c6df4d8b9963eea38371d546176:23

If you then run with npm install instead, everything works fine.

Is possible to use latest babel packages with meteor-webpack?

Hello, I tried to update these dependencies

    "babel-core": "^6.26.3",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",

to use the latest at @babel/ but then I got an error saying that babel-core is missing and it is really missing because I replaced by @babel/core

I think this error in coming from babel-loader, maybe babel-loader is not ready yet or I need to use some beta version of it?

Thanks

Not compatible with module resolver? (babel-plugin-module-resolver)

We use custom aliases throughout our app in order to make importing modules much easer (see https://www.npmjs.com/package/babel-plugin-module-resolver for more info).

We have defined our custom modules via .babelrc (and this works with Meteor). However, I cannot seem to get these to work with this meteor-webpack package. Can you confirm if this is a compatibility issue? Are you able to update the example configs to show this working?

Every time it tries to compile, it complains about not being able to resolve paths (as it's not resolving the custom alias paths for our imports).

Thanks for your help!

Uncaught TypeError: Cannot read property 'Mongo' of undefined

Hey there,

After testing both the React example and my own application, I'm coming across identical errors:

Uncaught TypeError: Cannot read property 'Mongo' of undefined

In the example, Webpack transpiles the code to:

var Tasks = exports.Tasks = new _mongo.Mongo.Collection('tasks');

It is attempting to read _mongo.Mongo, which I'm fairly certain isn't an object. This prevents the entire app from running. Any ideas as to why?

OS: Linux Mint 18.3

Thanks.

With TypeScript the meteor packages can't be found

How can I let the ts-loader be aware of the Meteor packages? If I have a ts / tsx file, I get the following error when using import { withTracker } from 'meteor/react-meteor-data';:

ERROR in /example.tsx
[tsl] ERROR in /example.tsx(3,29)
TS2307: Cannot find module 'meteor/react-meteor-data'.

This is my webpack.config.js:

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const meteorExternals = require('webpack-meteor-externals');
// const nodeExternals = require('webpack-node-externals');

/**
 * currently does not compileOnSave
 * https://github.com/TypeStrong/ts-loader/issues/40
 * https://github.com/jcoreio/crater/issues/157 - more complex settings?
 */
const clientConfig = {
  entry: './client/main.tsx',
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: ['babel-loader']
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
//  devtool: 'inline-source-map',
  plugins: [
    new HtmlWebpackPlugin({
      template: './client/main.html'
    }),
    new webpack.HotModuleReplacementPlugin()
  ],
  resolve: {
    extensions: ['*', '.js', '.jsx', '.tsx', '.ts']
  },
  output: {
    path: __dirname + '/dist',
    publicPath: '/',
    filename: 'bundle.js'
  },
  devServer: {
    contentBase: './dist',
    hot: true
  },
  externals: [
    meteorExternals()
  ]
};

const serverConfig = {
  entry: [
    './server/main.js'
  ],
  target: 'node',
  module: {
    rules: [{
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
  /*
  devServer: {
    hot: true
  },
  */
  externals: [
    meteorExternals(),
//    nodeExternals() // in order to ignore all modules in node_modules folder
  ]
};

module.exports = [clientConfig, serverConfig];

And this my tsconfig.json:

{
  "compilerOptions": {
    "target": "es6",
    "lib": ["DOM", "ES6", "ScriptHost"],
    "module": "commonjs",
    "moduleResolution": "node",
    "alwaysStrict": true,
    "sourceMap": true,
    "jsx": "react",
    "allowJs": true,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "allowSyntheticDefaultImports": true,
    "rootDir": ".",
    "baseUrl": ".",
    "outDir": "./.tscout/",
    "paths": {
      "*": ["*"]
    }
  },
  "compileOnSave": true,
  "include": [
    "client/**/*",
    "server/**/*"
  ],
  "exclude": [
    "node_modules"
  ],
  "files": [
    "imports/types/declarations.d.ts",
    "lib/router.js"
  ]
}

Any thoughts? Help is appreciated.

Handling separate dev and prod configs

Hi @ardatan - firstly, thanks a lot for creating this, it's really a great tool.

I have implemented a standard config, I'll write it out at the bottom in case you're interested.

If I want to define certain plugins by environment, such as devtool: "inline-source-map", how do I do that?

I am receiving the error: Cannot read property 'getSourceHash' of undefined (at Object.processFilesForTarget).

My setup is as follows, trying to use the webpack docs alongside yours:

webpack.dev.js

const webpack = require("webpack");
const merge = require("webpack-merge");
const common = require("./webpack.common.js");

const clientConfig = merge(common.clientConfig, {
  mode: "development",
  devtool: "inline-source-map",
  devServer: {
    hot: true
  },
  plugins: [new webpack.HotModuleReplacementPlugin()]
});

const serverConfig = merge(common.clientConfig, {
  mode: "development",
  devtool: "inline-source-map",
  devServer: {
    hot: true
  },
  plugins: [new webpack.HotModuleReplacementPlugin()]
});

module.exports = [clientConfig, serverConfig];

webpack.prod.js

const merge = require("webpack-merge");
const common = require("./webpack.common.js");

const clientConfig = merge(common.clientConfig, {
  mode: "production"
});

const serverConfig = merge(common.clientConfig, {
  mode: "production"
});

module.exports = [clientConfig, serverConfig];

webpack.common.js

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const meteorExternals = require("webpack-meteor-externals");
const nodeExternals = require("webpack-node-externals");

const clientConfig = {
  entry: "./client/main.jsx",
  module: {
    rules: [
      {
        test: /\.(scss|css)$/,
        loaders: ["style-loader", "css-loader", "sass-loader"],
        include: path.resolve(__dirname, "../")
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        loader: "url-loader",
        options: { limit: 10000 }
      },
      {
        test: /\.ttf?$/,
        loader: "url-loader",
        options: {
          limit: 10000,
          mimetype: "application/octet-stream"
        }
      },
      {
        test: /\.tsx?$/,
        use: "ts-loader",
        exclude: /node_modules/
      },
      {
        test: /\.jsx?$/,
        loader: "babel-loader",
        options: {
          configFile: "./assets/app/babel.config.js"
        },
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: ["*", ".js", ".jsx", ".json", ".ts", ".tsx"]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./client/main.html"
    })
  ],
  externals: [meteorExternals()]
};

const serverConfig = {
  entry: ["./server/main.js"],
  target: "node",
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: "babel-loader",
        options: {
          configFile: "./assets/app/babel.config.js"
        },
        exclude: /node_modules/
      },
      {
        test: /\.tsx?$/,
        use: "ts-loader",
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: ["*", ".js", ".json", ".ts", ".jsx", ".tsx"]
  },
  externals: [meteorExternals(), nodeExternals()]
};

module.exports = { clientConfig, serverConfig };

production ready?

Hello!

Thanks for creating this! The reload time with meteor is really annoying! specially for the frontend.

Just tried to migrate a medium sized meteor and react project.
And it worked pretty good! (If I find som issue I will submit them. )

I was thinking if this is production ready? Can I make a production build?

I use galaxy for my deploy.

Publications and methods are not found in HMR

Hi, @ardatan.
First of all, thank you for your job, I am very appreciate.

I was integrated your package to my project, and faced with the problem: in development, hot module replacement has a strange behavior. The problem is where the client app receives a hot update from Webpack, while the server is booting up (average boot time around 30sec.), so the client app crashes with errors that publications and methods are not found.

I did some investigation and found that doneHandler removes my meteor method and publication handlers, and after the new version is boot up in memory they are initialized again. But in our case, this is a gap is around 30 seconds.

App stack: we use Meteor 1.6.1, typescript and Angular5 app with integrated HMR module.

P.S.
I was tried to implement the reacting on special Meteor events, but it looks like a hack and workaround. And my app still fails at unsubscribing from publications, when the app is trying to destroy self. Because they are absent.

Maybe need some async mechanism which will emit the event to client HMR after doneHandler was completed.

It would be nice if you have any idea how to implement it or any suggestion.

webpack_plugin.js:74:31: webpack is not defined

Hello, thank you for your package 😉 it will be very nice to use webpack with Meteor.

I have a pretty standard React project with Meteor and I tried to follow the README steps but I got this error:

While processing files with ardatan:webpack (for target os.linux.x86_64):
   packages/webpack_plugin.js:74:31: webpack is not defined
   at Object.constructNewCompilerForTarget (packages/webpack_plugin.js:74:31)
   at Object.processFilesForTarget (packages/webpack_plugin.js:85:22)

Do you have any idea of what can be wrong on my code?

Multiple entry points

I get this error:

W20190530-11:41:01.327(2)? (STDERR) TypeError: singleWebpackConfig.entry[key].push is not a function
W20190530-11:41:01.327(2)? (STDERR)     at arrangeConfig (packages/ardatan_webpack-dev-middleware.js:242:48)

For this config:

let clientConfig = {
    entry: {
        main: './client/main.tsx',
        widget: './client/widget.tsx'
    },
    ...
}

Can be fixed by:

let clientConfig = {
    entry: {
        main: ['./client/main.tsx'],
        widget: ['./client/widget.tsx']
    },
    ...
}

I will create a PR to fix it.

Angular example not working

Hello,

After a while of trying to execute the Angular example I could not run it successfully. I have found two issues:
Missing "require-from-string" dependency (after installing it is gone).
And wrapper the Meteor.publish with Meteor.isServer (was trying to execute in client and crashing):

if (Meteor.isServer) {
    Meteor.publish('todos', function () {
        return Todos.find();
    });
}

After fixing this to small issues I got:

=> Started proxy.
=> A patch (Meteor 1.7.0.5) for your current release is available!
   Update this project now with 'meteor update --patch'.
=> Started MongoDB.
I20181214-12:01:59.703(1)? Starting type checking service...
I20181214-12:01:59.738(1)? Using 1 worker with 2048MB memory limit
W20181214-12:01:59.738(1)? (STDERR)   0% compiling  0% compiling(node:5000) DeprecationWarning: Tapable.plugin is deprecated. Use new API on '.hooks' instead
=> Started your app.

=> App running at: http://localhost:3000/
I20181214-12:02:03.305(1)? No type errors found
I20181214-12:02:03.305(1)? Version: typescript 2.4.2
I20181214-12:02:03.305(1)? Time: 2744ms
W2018121⚠ 「wdm」: Hash: 0c46f70f024a105f0429fa8c91b9ae8af5a36d85
W20181214-12:02:03.370(1)? (STDERR) Version: webpack 4.2.0
W20181214-12:02:03.371(1)? (STDERR) Child client:
W20181214-12:02:03.372(1)? (STDERR)     Hash: 0c46f70f024a105f0429
W20181214-12:02:03.372(1)? (STDERR)     Time: 5654ms
W20181214-12:02:03.372(1)? (STDERR)     Built at: 2018-12-14 12:02:03
W20181214-12:02:03.372(1)? (STDERR)           Asset       Size  Chunks             Chunk Names
W20181214-12:02:03.372(1)? (STDERR)         main.js   3.29 MiB    main  [emitted]  main
W20181214-12:02:03.372(1)? (STDERR)     main.js.map    727 KiB    main  [emitted]  main
W20181214-12:02:03.372(1)? (STDERR)      index.html  159 bytes          [emitted]
W20181214-12:02:03.372(1)? (STDERR)     Entrypoint main = main.js main.js.map
W20181214-12:02:03.373(1)? (STDERR)     [./$$_lazy_route_resource lazy recursive] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/$$_lazy_route_resource lazy namespace object 160 bytes {main} [built]
W20181214-12:02:03.375(1)? (STDERR)     [./client/app/app.component.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/app/app.component.ts 1.45 KiB {main} [built]
W20181214-12:02:03.375(1)? (STDERR)     [./client/app/app.module.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/app/app.module.ts 1.17 KiB {main} [built]
W20181214-12:02:03.376(1)? (STDERR)     [./client/index.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/index.ts 413 bytes {main} [built]
W20181214-12:02:03.376(1)? (STDERR)     [./node_modules/@angular/common/esm5/common.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/common/esm5/common.js 223 KiB {main} [built]
W20181214-12:02:03.392(1)? (STDERR)     [./node_modules/@angular/compiler/esm5/compiler.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/compiler/esm5/compiler.js 1.16 MiB {main} [built]
W20181214-12:02:03.393(1)? (STDERR)     [./node_modules/@angular/core/esm5/core.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/core/esm5/core.js 613 KiB {main} [built] [2 warnings]
W20181214-12:02:03.393(1)? (STDERR)     [./node_modules/@angular/forms/esm5/forms.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/forms/esm5/forms.js 258 KiB {main} [built]
W20181214-12:02:03.395(1)? (STDERR)     [./node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js 24.2 KiB {main} [built]
W20181214-12:02:03.395(1)? (STDERR)     [./node_modules/@angular/platform-browser/esm5/platform-browser.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/platform-browser/esm5/platform-browser.js 162 KiB {main} [built]
W20181214-12:02:03.395(1)? (STDERR)     [./node_modules/rxjs/operator/share.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/rxjs/operator/share.js 1.12KiB {main} [built]
W20181214-12:02:03.398(1)? (STDERR)     [./node_modules/tslib/tslib.es6.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/tslib/tslib.es6.js 8.2 KiB {main} [built]
W20181214-12:02:03.399(1)? (STDERR)     [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {main} [built]
W20181214-12:02:03.399(1)? (STDERR)     [./node_modules/zone.js/dist/zone.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/zone.js/dist/zone.js 125 KiB {main} [built]
W20181214-12:02:03.399(1)? (STDERR)     [meteor/meteor] external "Package['meteor']" 42 bytes {main} [built]
W20181214-12:02:03.399(1)? (STDERR)         + 177 hidden modules
W20181214-12:02:03.401(1)? (STDERR)
W20181214-12:02:03.401(1)? (STDERR)     WARNING in /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/core/esm5/core.js
W20181214-12:02:03.401(1)? (STDERR)     System.import() is deprecated and will be removed soon. Use import() instead.
W20181214-12:02:03.401(1)? (STDERR)     For more info visit https://webpack.js.org/guides/code-splitting/
W20181214-12:02:03.401(1)? (STDERR)      @ /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/index.ts 6558:15-36 5:0-47 9:8-22
W20181214-12:02:03.401(1)? (STDERR)
W20181214-12:02:03.402(1)? (STDERR)     WARNING in /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/@angular/core/esm5/core.js
W20181214-12:02:03.402(1)? (STDERR)     System.import() is deprecated and will be removed soon. Use import() instead.
W20181214-12:02:03.403(1)? (STDERR)     For more info visit https://webpack.js.org/guides/code-splitting/
W20181214-12:02:03.403(1)? (STDERR)      @ /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/index.ts 6578:15-102 5:0-47 9:8-22
W20181214-12:02:03.403(1)? (STDERR)     Child html-webpack-plugin for "index.html":
W20181214-12:02:03.403(1)? (STDERR)              Asset      Size                                Chunks  Chunk Names
W20181214-12:02:03.403(1)? (STDERR)         index.html  3.18 KiB  html-webpack-plugin for "index.html"  html-webpack-plugin for "index.html"
W20181214-12:02:03.403(1)? (STDERR)         Entrypoint html-webpack-plugin for "index.html" = index.html
W20181214-12:02:03.405(1)? (STDERR)         [./node_modules/html-webpack-plugin/lib/loader.js!./client/index.html] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/html-webpack-plugin/lib/loader.js!/Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/client/index.html 134 bytes {html-webpack-plugin for "index.html"} [built]
W20181214-12:02:03.405(1)? (STDERR) Child server:
W20181214-12:02:03.405(1)? (STDERR)     Hash: fa8c91b9ae8af5a36d85
W20181214-12:02:03.405(1)? (STDERR)     Time: 5753ms
W20181214-12:02:03.405(1)? (STDERR)     Built at: 2018-12-14 12:02:03
W20181214-12:02:03.406(1)? (STDERR)       Asset     Size  Chunks             Chunk Names
W20181214-12:02:03.406(1)? (STDERR)     main.js  102 KiB    main  [emitted]  main
W20181214-12:02:03.406(1)? (STDERR)     Entrypoint main = main.js
W20181214-12:02:03.406(1)? (STDERR)     [./imports/todos.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/imports/todos.ts 107 bytes {main} [built]
W20181214-12:02:03.406(1)? (STDERR)     [./node_modules/meteor-rxjs/dist/MeteorObservable.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/meteor-rxjs/dist/MeteorObservable.js 8.61 KiB {main} [built]
W20181214-12:02:03.408(1)? (STDERR)     [./node_modules/meteor-rxjs/dist/ObservableCollection.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/meteor-rxjs/dist/ObservableCollection.js 11.6 KiB {main} [built]
W20181214-12:02:03.408(1)? (STDERR)     [./node_modules/meteor-rxjs/dist/ObservableCursor.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/meteor-rxjs/dist/ObservableCursor.js 6.6 KiB {main} [built]
W20181214-12:02:03.409(1)? (STDERR)     [./node_modules/meteor-rxjs/dist/index.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/meteor-rxjs/dist/index.js 169 bytes {main} [built]
W20181214-12:02:03.441(1)? (STDERR)     [./node_modules/meteor-rxjs/dist/zone.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/meteor-rxjs/dist/zone.js 1.88 KiB {main} [built]
W20181214-12:02:03.441(1)? (STDERR)     [./node_modules/rxjs/Observable.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/rxjs/Observable.js 12.9 KiB {main} [built]
W20181214-12:02:03.442(1)? (STDERR)     [./node_modules/rxjs/Subject.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/rxjs/Subject.js 5.48 KiB {main} [built]
W20181214-12:02:03.442(1)? (STDERR)     [./node_modules/rxjs/Subscriber.js] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/node_modules/rxjs/Subscriber.js 9.55 KiB {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [./server/addTodo.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/server/addTodo.ts 209 bytes {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [./server/greeting.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/server/greeting.ts 139 bytes {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [./server/index.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/server/index.ts 122 bytes {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [./server/removeTodo.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/server/removeTodo.ts 204 bytes {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [./server/todos.ts] /Users/christianmartinezpinzon/Workspace/Projects/meteor-webpack/examples/angular/server/todos.ts 203 bytes {main} [built]
W20181214-12:02:03.443(1)? (STDERR)     [meteor/meteor] external "Package['meteor']" 42 bytes {main} [built]
W20181214-12:02:03.444(1)? (STDERR)         + 17 hidden modules
I20181214-12:02:03.444(1)? ℹ 「wdm」: Compiled with warnings.
I20181214-12:02:03.479(1)? Hello World from Server

I have no clue of how to continue. Could you review it, please?
Thank you!

Cannot use bcrypt in server

Modifying the example to import bcrypt results in all kinds of errors. What is the way to use module that webpack / babel don't accept, cannot handle? It seems like marking them as externals doesn't work because meteor doesn't allow them to be imported.

$ pwd
/home/ubuntu/meteor-webpack/examples/react
$ git diff
diff --git a/examples/react/imports/api/tasks.js b/examples/react/imports/api/tasks.js
index d7d72dd..aed05d0 100644
--- a/examples/react/imports/api/tasks.js
+++ b/examples/react/imports/api/tasks.js
@@ -1,6 +1,7 @@
 import { Meteor } from 'meteor/meteor';
 import { Mongo } from 'meteor/mongo';
 import { check } from 'meteor/check';
+import bcrypt from 'bcrypt';
 
 export const Tasks = new Mongo.Collection('tasks');
 
@@ -60,6 +61,8 @@ Meteor.methods({
     check(taskId, String);
     check(setToPrivate, Boolean);
 
+    bcrypt.hashSync('bacon', 8);
+
     const task = Tasks.findOne(taskId);
 
     // Make sure only the task owner can make a task private
diff --git a/examples/react/package.json b/examples/react/package.json
index 743fa5e..cba227d 100644
--- a/examples/react/package.json
+++ b/examples/react/package.json
@@ -6,7 +6,7 @@
   },
   "dependencies": {
     "@babel/runtime": "7.0.0-beta.46",
-    "bcrypt": "^1.0.3",
+    "bcrypt": "^3.0.0",
     "classnames": "^2.2.5",
     "meteor-node-stubs": "^0.3.3",
     "react": "^16.3.2",

$ yarn start

...
W20180712-16:05:01.799(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js 6:15-36
W20180712-16:05:01.799(-7)? (STDERR)     Critical dependency: the request of a dependency is an expression
W20180712-16:05:01.799(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.799(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.799(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.799(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.799(-7)? (STDERR)     
W20180712-16:05:01.799(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48
W20180712-16:05:01.800(-7)? (STDERR)     Critical dependency: the request of a dependency is an expression
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.800(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.800(-7)? (STDERR)     
W20180712-16:05:01.800(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67
W20180712-16:05:01.800(-7)? (STDERR)     Critical dependency: the request of a dependency is an expression
W20180712-16:05:01.800(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/pre-binding.js
W20180712-16:05:01.801(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.801(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.801(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.801(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.801(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.801(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.801(-7)? (STDERR)     
W20180712-16:05:01.801(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js
W20180712-16:05:01.801(-7)? (STDERR)     Module not found: Error: Can't resolve 'node-gyp' in '/home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util'
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib sync ^\.\/.*$
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.802(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.802(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.803(-7)? (STDERR)     
W20180712-16:05:01.803(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js
W20180712-16:05:01.803(-7)? (STDERR)     Module not found: Error: Can't resolve 'npm' in '/home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util'
W20180712-16:05:01.803(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js
W20180712-16:05:01.803(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib sync ^\.\/.*$
W20180712-16:05:01.803(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.803(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.803(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.804(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.804(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.804(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.804(-7)? (STDERR)     
W20180712-16:05:01.804(-7)? (STDERR)     WARNING in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
W20180712-16:05:01.804(-7)? (STDERR)     Module parse failed: Unexpected token (1:0)
W20180712-16:05:01.804(-7)? (STDERR)     You may need an appropriate loader to handle this file type.
W20180712-16:05:01.804(-7)? (STDERR)     > <!doctype html>
W20180712-16:05:01.805(-7)? (STDERR)     | <html>
W20180712-16:05:01.805(-7)? (STDERR)     | <head>
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib sync ^\.\/.*$ ./util/nw-pre-gyp/index.html
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.805(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.805(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.805(-7)? (STDERR)     
W20180712-16:05:01.806(-7)? (STDERR)     ERROR in /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/unpublish.js
W20180712-16:05:01.806(-7)? (STDERR)     Module not found: Error: Can't resolve 'aws-sdk' in '/home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib'
W20180712-16:05:01.806(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/unpublish.js 16:14-32
W20180712-16:05:01.806(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib sync ^\.\/.*$
W20180712-16:05:01.807(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/node_modules/node-pre-gyp/lib/node-pre-gyp.js
W20180712-16:05:01.807(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/node_modules/bcrypt/bcrypt.js
W20180712-16:05:01.807(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/imports/api/tasks.js
W20180712-16:05:01.807(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/ui/App.jsx
W20180712-16:05:01.808(-7)? (STDERR)      @ /home/ubuntu/meteor-webpack/examples/react/client/main.jsx
W20180712-16:05:01.808(-7)? (STDERR)      @ multi ./client/main.jsx webpack-hot-middleware/client?reload=true
W20180712-16:05:01.808(-7)? (STDERR)     

... and so on ...

I've tried messing around with stuff like the webpack-node-externals package but then it seems like nothing in node_modules can be imported at runtime - meteor doesn't include any of that in the folder it builds into.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.