Skip to content

Instantly share code, notes, and snippets.

@romanlv
Last active August 29, 2015 14:24
Show Gist options
  • Save romanlv/16365aba918d1bab0de1 to your computer and use it in GitHub Desktop.
Save romanlv/16365aba918d1bab0de1 to your computer and use it in GitHub Desktop.
minified-leagacyie webpack problem
node_modules/*
dist/*

problem

minified-leagacyie (v1.0.1) does not work when used with webpack

It works fine with "regular" minified.js

issue seems to be related to using _window variable, which when used with webpack points to some wrapper object, not a browser window

how to run

npm install 
webpack 
http-server
# open in Chrome browser **assigned address**/test-ie.html 

check javascript console, there is an error ReferenceError: ActiveXObject is not defined

removing alias in webpack.config.js (using normal minified.js) fixes the problem

{
"name": "minified-ie-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"minified": "^1.0.1"
}
}
<!DOCTYPE html>
<html>
<head>
<!--script src="http://minifiedjs.com/download/minified-legacyie-src.js"></script-->
<script src="dist/test-ie.js"></script>
</head>
<body>
<h1>Testing Minified $.request with webpack !</h1>
<div id="data">
</div>
<script>
// var test = require('dist/test-ie')
// test.run()
MinifiedTestIe.run('#data')
</script>
</body>
</html>
var MINI = require('minified')
var $ = MINI.$;
function run(container){
console.log('sfds');
$.request('get', 'https://api.github.com', {}, {})
.then(function(r){
console.log('request is successfull');
$(container).ht('it worked, here is a data: ' + r);
})
.error(function(status, txt, err){
console.error('error firing request: %o', err)
});
}
window.MinifiedTestIe = {
run: run
}
module.exports = run;
var path = require("path");
var webpack = require("webpack");
module.exports = {
entry: ["./test-ie.js"],
output: {
path: "dist",
filename: "test-ie.js",
},
resolve: {
modulesDirectories: ['node_modules'], //, 'js/libs'
alias: {
minified: 'minified/minified-legacyie-src' //
}
},
plugins: [
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment