Add type attribute to script element
* Update index.js to add type attribute * Update tests * Build examples to update HTML * Update CHANGELOG
This commit is contained in:
parent
0952b3a810
commit
b718dc1c2c
|
|
@ -1,6 +1,10 @@
|
|||
Change History
|
||||
==============
|
||||
|
||||
v2.17.0
|
||||
----
|
||||
* Add `type` attribute to `script` element to prevent issues in Safari 9.1.1
|
||||
|
||||
v2.16.2
|
||||
----
|
||||
* Fix bug introduced by 2.16.2. Fixes #315
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script></body></html>
|
||||
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
CACHE MANIFEST
|
||||
# 9e067d48ea3de65b9733
|
||||
# 118634423ed0edb86d58
|
||||
|
||||
0714810ae3fb211173e2964249507195.png
|
||||
bundle.js
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script></body></html>
|
||||
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@
|
|||
<body>
|
||||
<h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png">
|
||||
<script src="bundle.js"></script></body>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
@ -8,5 +8,5 @@
|
|||
<body>
|
||||
<h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png">
|
||||
<script src="bundle.js"></script></body>
|
||||
</html>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
<title>Webpack App</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="bundle.js"></script></body>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
@ -5,5 +5,5 @@
|
|||
<title>Webpack App</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="bundle.js"></script></body>
|
||||
</html>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
<title>HtmlWebpackPlugin example</title>
|
||||
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<script src="bundle.js"></script></body>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
@ -5,5 +5,5 @@
|
|||
<title>HtmlWebpackPlugin example</title>
|
||||
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<script src="bundle.js"></script></body>
|
||||
</html>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<img src="0714810ae3fb211173e2964249507195.png">
|
||||
<script src="bundle.js"></script></body>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
@ -7,5 +7,5 @@
|
|||
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<img src="0714810ae3fb211173e2964249507195.png">
|
||||
<script src="bundle.js"></script></body>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
@ -7,5 +7,5 @@
|
|||
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<img src="0714810ae3fb211173e2964249507195.png">
|
||||
<script src="bundle.js"></script></body>
|
||||
</html>
|
||||
<script type="text/javascript" src="bundle.js"></script></body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>Jade demo</title></head><body><style>body {
|
||||
background: snow;
|
||||
}</style><script>/******/ (function(modules) { // webpackBootstrap
|
||||
}</style><script type="text/javascript">/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ html
|
|||
each cssFile in htmlWebpackPlugin.files.css
|
||||
style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
|
||||
each jsFile in htmlWebpackPlugin.files.js
|
||||
script !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
|
||||
script(type="text/javascript") !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<!DOCTYPE html><html><head><title>Jade demo</title><link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head><body><div id="main"><!-- this partial is used for frontend and backend--><div class="time"> <b>Current time</b><p>1998-12-31T23:00:00.000Z</p></div><img src="0714810ae3fb211173e2964249507195.png"></div><script src="bundle.js"></script></body></html>
|
||||
<!DOCTYPE html><html><head><title>Jade demo</title><link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head><body><div id="main"><!-- this partial is used for frontend and backend--><div class="time"> <b>Current time</b><p>1999-01-01T06:00:00.000Z</p></div><img src="0714810ae3fb211173e2964249507195.png"></div><script type="text/javascript" src="bundle.js"></script></body></html>
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
<html><head><title>Webpack App</title><link href="styles.css" rel="stylesheet"></head><body>Hello World from backend - <h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script></body></html>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
<html><head><title>Webpack App</title><link href="styles.css" rel="stylesheet"></head><body>Hello World from backend - <h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script></body></html>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
<head><link href="styles.css" rel="stylesheet"></head>Hello World from backend2016-03-21T08:52:41.516Z<h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script>
|
||||
<head><link href="styles.css" rel="stylesheet"></head>Hello World from backend2016-05-01T21:59:56.131Z<h2>Partial</h2>
|
||||
<img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script>
|
||||
2
index.js
2
index.js
|
|
@ -450,7 +450,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
|
|||
HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function (html, assets) {
|
||||
// Turn script files into script tags
|
||||
var scripts = assets.js.map(function (scriptPath) {
|
||||
return '<script src="' + scriptPath + '"></script>';
|
||||
return '<script type="text/javascript" src="' + scriptPath + '"></script>';
|
||||
});
|
||||
// Make tags self-closing in case of xhtml
|
||||
var xhtml = this.options.xhtml ? '/' : '';
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, [/<body>[\s]*<script src="index_bundle.js"><\/script>[\s]*<\/body>/], null, done);
|
||||
}, [/<body>[\s]*<script type="text\/javascript" src="index_bundle.js"><\/script>[\s]*<\/body>/], null, done);
|
||||
});
|
||||
|
||||
it('generates a default index.html file with multiple entry points', function (done) {
|
||||
|
|
@ -113,7 +113,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: '[name]_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="util_bundle.js"', '<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to specify a custom loader without injection', function (done) {
|
||||
|
|
@ -130,7 +130,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
template: 'jade-loader!' + path.join(__dirname, 'fixtures/template.jade')
|
||||
})]
|
||||
},
|
||||
['<script src="app_bundle.js', 'Some unique text'], null, done);
|
||||
['<script type="text/javascript" src="app_bundle.js', 'Some unique text'], null, done);
|
||||
});
|
||||
|
||||
it('should pass through loader errors', function (done) {
|
||||
|
|
@ -169,7 +169,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
template: path.join(__dirname, 'fixtures/template.jade')
|
||||
})]
|
||||
},
|
||||
['<script src="app_bundle.js', 'Some unique text'], null, done);
|
||||
['<script type="text/javascript" src="app_bundle.js', 'Some unique text'], null, done);
|
||||
});
|
||||
|
||||
it('works when using html-loader', function (done) {
|
||||
|
|
@ -186,7 +186,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
template: 'html-loader!' + path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
},
|
||||
['<script src="app_bundle.js"'], null, done);
|
||||
['<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to specify your own HTML template file', function (done) {
|
||||
|
|
@ -203,7 +203,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
inject: false
|
||||
})]
|
||||
},
|
||||
['<script src="app_bundle.js', 'Some unique text'], null, done);
|
||||
['<script type="text/javascript" src="app_bundle.js', 'Some unique text'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject the assets into a given html file', function (done) {
|
||||
|
|
@ -220,7 +220,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
inject: true,
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="util_bundle.js"', '<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject the assets into the body of the given template', function (done) {
|
||||
|
|
@ -237,7 +237,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
inject: 'body',
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="util_bundle.js"', '<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject the assets into the head of the given template', function (done) {
|
||||
|
|
@ -254,7 +254,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
inject: 'head',
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="util_bundle.js"', '<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject a specified asset into a given html file', function (done) {
|
||||
|
|
@ -272,7 +272,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
chunks: ['app'],
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject a specified asset into a given html file', function (done) {
|
||||
|
|
@ -290,7 +290,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
excludeChunks: ['util'],
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="app_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to use chunkhash with asset into a given html file', function (done) {
|
||||
|
|
@ -309,7 +309,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}, [{
|
||||
type: 'chunkhash',
|
||||
chunkName: 'app',
|
||||
containStr: '<script src="app_bundle.js?%chunkhash%"'
|
||||
containStr: '<script type="text/javascript" src="app_bundle.js?%chunkhash%"'
|
||||
}], null, done);
|
||||
});
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}
|
||||
})]
|
||||
},
|
||||
['<script src="app_bundle.js"'], null, done);
|
||||
['<script type="text/javascript" src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('works with source maps', function (done) {
|
||||
|
|
@ -355,7 +355,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="index_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="index_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('handles hashes in bundle filenames', function (done) {
|
||||
|
|
@ -366,7 +366,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle_[hash].js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, [/<script src="index_bundle_[0-9a-f]+\.js"*/], null, done);
|
||||
}, [/<script type="text\/javascript" src="index_bundle_[0-9a-f]+\.js"*/], null, done);
|
||||
});
|
||||
|
||||
it('handles hashes in the directory which has the bundle file', function (done) {
|
||||
|
|
@ -378,7 +378,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle_[hash].js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, [/<script src="\/dist\/[0-9a-f]+\/index_bundle_[0-9a-f]+\.js"*/], null, done);
|
||||
}, [/<script type="text\/javascript" src="\/dist\/[0-9a-f]+\/index_bundle_[0-9a-f]+\.js"*/], null, done);
|
||||
});
|
||||
|
||||
it('allows to append hashes to the assets', function (done) {
|
||||
|
|
@ -389,7 +389,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({hash: true})]
|
||||
}, ['<script src="index_bundle.js?%hash%"'], null, done);
|
||||
}, ['<script type="text/javascript" src="index_bundle.js?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('allows to append hashes to the assets', function (done) {
|
||||
|
|
@ -400,7 +400,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({hash: true, inject: true})]
|
||||
}, ['<script src="index_bundle.js?%hash%"'], null, done);
|
||||
}, ['<script type="text/javascript" src="index_bundle.js?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('should work with the css extract plugin', function (done) {
|
||||
|
|
@ -533,7 +533,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
publicPath: 'http://cdn.example.com/assets/'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="http://cdn.example.com/assets/index_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="http://cdn.example.com/assets/index_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('handles subdirectories in the webpack output bundles', function (done) {
|
||||
|
|
@ -544,7 +544,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'assets/index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="assets/index_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="assets/index_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('handles subdirectories in the webpack output bundles along with a public path', function (done) {
|
||||
|
|
@ -556,7 +556,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
publicPath: 'http://cdn.example.com/'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="http://cdn.example.com/assets/index_bundle.js"'], null, done);
|
||||
}, ['<script type="text/javascript" src="http://cdn.example.com/assets/index_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to configure the title of the generated HTML page', function (done) {
|
||||
|
|
@ -578,7 +578,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({filename: 'test.html'})]
|
||||
}, ['<script src="index_bundle.js"'], 'test.html', done);
|
||||
}, ['<script type="text/javascript" src="index_bundle.js"'], 'test.html', done);
|
||||
});
|
||||
|
||||
it('will replace [hash] in the filename with the child compilation hash', function (done) {
|
||||
|
|
@ -591,7 +591,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
plugins: [new HtmlWebpackPlugin({
|
||||
filename: 'test-[hash].html'
|
||||
})]
|
||||
}, ['<script src="index_bundle.js"'], /test-\S+\.html$/, done);
|
||||
}, ['<script type="text/javascript" src="index_bundle.js"'], /test-\S+\.html$/, done);
|
||||
});
|
||||
|
||||
it('allows you to use an absolute output filename', function (done) {
|
||||
|
|
@ -604,7 +604,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
plugins: [new HtmlWebpackPlugin({
|
||||
filename: path.resolve(OUTPUT_DIR, 'subfolder', 'test.html')
|
||||
})]
|
||||
}, ['<script src="../index_bundle.js"'], path.join('subfolder', 'test.html'), done);
|
||||
}, ['<script type="text/javascript" src="../index_bundle.js"'], path.join('subfolder', 'test.html'), done);
|
||||
});
|
||||
|
||||
it('allows you to use an absolute output filename outside the output path', function (done) {
|
||||
|
|
@ -617,7 +617,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
plugins: [new HtmlWebpackPlugin({
|
||||
filename: path.resolve(OUTPUT_DIR, 'test.html')
|
||||
})]
|
||||
}, ['<script src="app/index_bundle.js"'], 'test.html', done);
|
||||
}, ['<script type="text/javascript" src="app/index_bundle.js"'], 'test.html', done);
|
||||
});
|
||||
|
||||
it('allows you to use an relative output filename outside the output path', function (done) {
|
||||
|
|
@ -630,7 +630,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
plugins: [new HtmlWebpackPlugin({
|
||||
filename: '../test.html'
|
||||
})]
|
||||
}, ['<script src="app/index_bundle.js"'], 'test.html', done);
|
||||
}, ['<script type="text/javascript" src="app/index_bundle.js"'], 'test.html', done);
|
||||
});
|
||||
|
||||
it('will try to use a relative name if the filename is in a subdirectory', function (done) {
|
||||
|
|
@ -641,7 +641,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({filename: 'assets/test.html'})]
|
||||
}, ['<script src="../index_bundle.js"'], 'assets/test.html', done);
|
||||
}, ['<script type="text/javascript" src="../index_bundle.js"'], 'assets/test.html', done);
|
||||
});
|
||||
|
||||
it('will try to use a relative name if the filename and the script are in a subdirectory', function (done) {
|
||||
|
|
@ -652,7 +652,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
filename: 'assets/index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({filename: 'assets/demo/test.html'})]
|
||||
}, ['<script src="../../assets/index_bundle.js"'], 'assets/demo/test.html', done);
|
||||
}, ['<script type="text/javascript" src="../../assets/index_bundle.js"'], 'assets/demo/test.html', done);
|
||||
});
|
||||
|
||||
it('allows you write multiple HTML files', function (done) {
|
||||
|
|
@ -675,7 +675,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
template: path.join(__dirname, 'fixtures/test.html')
|
||||
})
|
||||
]
|
||||
}, ['<script src="index_bundle.js"'], null, function () {
|
||||
}, ['<script type="text/javascript" src="index_bundle.js"'], null, function () {
|
||||
expect(fs.existsSync(path.join(OUTPUT_DIR, 'second-file.html'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(OUTPUT_DIR, 'third-file.html'))).toBe(true);
|
||||
done();
|
||||
|
|
@ -699,7 +699,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
new HtmlWebpackPlugin({template: path.join(__dirname, 'fixtures/empty_html.html')}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
}, ['<link href="styles.css"', '<script src="index_bundle.js"'], null, done);
|
||||
}, ['<link href="styles.css"', '<script type="text/javascript" src="index_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('exposes the webpack configuration to templates', function (done) {
|
||||
|
|
@ -864,7 +864,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
new HtmlWebpackPlugin(),
|
||||
examplePlugin
|
||||
]
|
||||
}, ['Injected by plugin', '<script src="funky-script.js"'], null, function () {
|
||||
}, ['Injected by plugin', '<script type="text/javascript" src="funky-script.js"'], null, function () {
|
||||
expect(eventFired).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
|
@ -898,7 +898,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}),
|
||||
examplePlugin
|
||||
]
|
||||
}, ['<script src="funky-script.js"'], null, function () {
|
||||
}, ['<script type="text/javascript" src="funky-script.js"'], null, function () {
|
||||
expect(eventFired).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
|
@ -924,8 +924,8 @@ describe('HtmlWebpackPlugin', function () {
|
|||
new HtmlWebpackPlugin()
|
||||
]
|
||||
}, [
|
||||
/<script src="common_bundle.js">[\s\S]*<script src="util_bundle.js">/,
|
||||
/<script src="common_bundle.js"[\s\S]*<script src="index_bundle.js">/], null, done);
|
||||
/<script type="text\/javascript" src="common_bundle.js">[\s\S]*<script type="text\/javascript" src="util_bundle.js">/,
|
||||
/<script type="text\/javascript" src="common_bundle.js"[\s\S]*<script type="text\/javascript" src="index_bundle.js">/], null, done);
|
||||
});
|
||||
|
||||
it('adds a favicon', function (done) {
|
||||
|
|
@ -1105,7 +1105,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
})
|
||||
]
|
||||
}, [
|
||||
/<script src="common_bundle.js">.+<script src="util_bundle.js">.+<script src="index_bundle.js">/], null, done);
|
||||
/<script type="text\/javascript" src="common_bundle.js">.+<script type="text\/javascript" src="util_bundle.js">.+<script type="text\/javascript" src="index_bundle.js">/], null, done);
|
||||
});
|
||||
|
||||
it('should sort the chunks in custom (reverse alphabetical) order', function (done) {
|
||||
|
|
@ -1132,7 +1132,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}
|
||||
})
|
||||
]
|
||||
}, [/<script src="c_bundle.js">.+<script src="b_bundle.js">.+<script src="a_bundle.js">/], null, done);
|
||||
}, [/<script type="text\/javascript" src="c_bundle.js">.+<script type="text\/javascript" src="b_bundle.js">.+<script type="text\/javascript" src="a_bundle.js">/], null, done);
|
||||
});
|
||||
|
||||
it('should sort the chunks by chunk dependencies', function (done) {
|
||||
|
|
@ -1160,7 +1160,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
})
|
||||
]
|
||||
}, [
|
||||
/<script src="common_bundle.js">.+<script src="aTheme_bundle.js">.+<script src="util_bundle.js">/], null, done);
|
||||
/<script type="text\/javascript" src="common_bundle.js">.+<script type="text\/javascript" src="aTheme_bundle.js">.+<script type="text\/javascript" src="util_bundle.js">/], null, done);
|
||||
});
|
||||
|
||||
it('should add the webpack compilation object as a property of the templateParam object', function (done) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>Some unique text</p>
|
||||
<script src="<%=foo.bar%>"></script>
|
||||
<script type="text/javascript" src="<%=foo.bar%>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>Some unique text</p>
|
||||
<script src="{%=o.htmlWebpackPlugin.assets.app%}"></script>
|
||||
<script type="text/javascript" src="{%=o.htmlWebpackPlugin.assets.app%}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ html
|
|||
body
|
||||
p Some unique text
|
||||
each jsFile in htmlWebpackPlugin.files.js
|
||||
script(src!=jsFile)
|
||||
script(type="text/javascript" src!=jsFile)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>Some unique text</p>
|
||||
<script src="<%=htmlWebpackPlugin.files.chunks.app.entry%>"></script>
|
||||
<script type="text/javascript" src="<%=htmlWebpackPlugin.files.chunks.app.entry%>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>Public path is <%= webpackConfig.output.publicPath %></p>
|
||||
<script src="<%= htmlWebpackPlugin.files.chunks.app.entry %>?<%= htmlWebpackPlugin.files.chunks.app.hash %>"></script>
|
||||
<script type="text/javascript" src="<%= htmlWebpackPlugin.files.chunks.app.entry %>?<%= htmlWebpackPlugin.files.chunks.app.hash %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue