Skip to content

Instantly share code, notes, and snippets.

@mcclure
Created December 28, 2015 00:16
Show Gist options
  • Save mcclure/be92b562d35ae923c50d to your computer and use it in GitHub Desktop.
Save mcclure/be92b562d35ae923c50d to your computer and use it in GitHub Desktop.
# THIS WORKS
mkdir -p a && mkdir -p b && (cd a && npm install jquery) && echo "module.exports = { context:\""`pwd`"/a\" }" > b/webpack.config.js && echo "require(\"jquery\")" > b/source.js && (cd b && webpack source.js bundle.js)
# WHAT IT PRINTS:
# jquery@2.1.4 ../node_modules/jquery
# Hash: 68508185a6c9c12015ac
# Version: webpack 1.12.9
# Time: 943ms
# Asset Size Chunks Chunk Names
# bundle.js 257 kB 0 [emitted] main
# [0] ../b/source.js 18 bytes {0} [built]
# + 1 hidden modules
# THIS DOES NOT WORK:
mkdir -p a && mkdir -p /tmp/b && (cd a && npm install jquery) && echo "module.exports = { context:\""`pwd`"/a\" }" > /tmp/b/webpack.config.js && echo "require(\"jquery\")" > /tmp/b/source.js && (cd /tmp/b && webpack source.js bundle.js)
# WHAT IT PRINTS:
# jquery@2.1.4 ../node_modules/jquery
# Hash: c8208bfc3430ea495979
# Version: webpack 1.12.9
# Time: 134ms
# Asset Size Chunks Chunk Names
# bundle.js 1.56 kB 0 [emitted] main
# [0] /private/tmp/b/source.js 18 bytes {0} [built] [1 error]
#
# ERROR in /private/tmp/b/source.js
# Module not found: Error: Cannot resolve module 'jquery' in /private/tmp/b
# @ /private/tmp/b/source.js 1:0-17
# THE ONLY DIFFERENCE BETWEEN THE TWO IS IN ONE CASE, THE b/ FOLDER IS IN /tmp, AND IN THE OTHER IT'S IN MY HOME DIRECTORY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment