Skip to content

Instantly share code, notes, and snippets.

@cpriest
Created November 12, 2018 02:41
Show Gist options
  • Save cpriest/f07d55d5acc95fa28da62507ab69888e to your computer and use it in GitHub Desktop.
Save cpriest/f07d55d5acc95fa28da62507ab69888e to your computer and use it in GitHub Desktop.
Issue trying to use webpack with import using a CDN URL.
> webpack --mode development
C:\code\node\ace-xterm>webpack --mode development
Hash: e76f245f37f70a4d68eb
Version: webpack 4.25.1
Time: 172ms
Built at: 11/11/2018 8:29:54 PM
Asset Size Chunks Chunk Names
main.js 21.8 KiB main [emitted] main
Entrypoint main = main.js
[./src/ace-editor.wc.js] 7.7 KiB {main} [built]
[./src/ace-xterm.wc.js] 4.1 KiB {main} [built]
[./src/index.js] 134 bytes {main} [built]
[./src/xterm-pane.wc.js] 2.21 KiB {main} [built]
ERROR in ./src/xterm-pane.wc.js
Module not found: Error: Can't resolve 'https://cdn.jsdelivr.net/npm/xterm@3.8.0/dist/xterm.js' in 'C:\code\node\ace-xterm\src'
@ ./src/xterm-pane.wc.js 3:0-89
@ ./src/index.js
ERROR in ./src/ace-editor.wc.js
Module not found: Error: Can't resolve 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ace.js' in 'C:\code\node\ace-xterm\src'
@ ./src/ace-editor.wc.js 19:0-85
@ ./src/index.js
ERROR in ./src/ace-editor.wc.js
Module not found: Error: Can't resolve 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ext-searchbox.js' in 'C:\code\node\ace-xterm\src'
@ ./src/ace-editor.wc.js 20:0-104
@ ./src/index.js
ERROR in ./src/ace-editor.wc.js
Module not found: Error: Can't resolve 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ext-statusbar.js' in 'C:\code\node\ace-xterm\src'
@ ./src/ace-editor.wc.js 21:0-104
@ ./src/index.js
'use strict';
import * as aceModule from 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ace.js';
import * as aceSearchBoxModule from 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ext-searchbox.js';
...
const webpack = require('webpack');
const path = require('path');
// Some of the below commented lines involve things I've tried to solve this issue
module.exports = {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
// noParse: /^http/,
// rules: [
// {
// test: /^http/,
// use: 'null-loader',
// }
// ]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment