Skip to content

Instantly share code, notes, and snippets.

@iOliverNguyen
Last active February 3, 2021 13:07
Show Gist options
  • Save iOliverNguyen/a7e65ee1e6ca47aeb7ef9e7edf697eab to your computer and use it in GitHub Desktop.
Save iOliverNguyen/a7e65ee1e6ca47aeb7ef9e7edf697eab to your computer and use it in GitHub Desktop.
<script type="module" src="myscript.js"></script>
<!doctype html>
<html lang="en">
<head>
<title>My little app</title>
</head>
<body>
<script type="module" src="myscript.js"></script>
</body>
</html>
// somewhere in lodash package
function snakeCase(input) {
// where magic happens
}
exports.snakeCase = snakeCase;
// somewhere in lodash package
export function snakeCase(input) {
// where magic happens
}
// myscript.ts
import {snakeCase} from 'lodash';
import './style.less'; // the less file
const words: string[] = ['HelloWorld', 'left pad', 'ECMAScript'];
words.forEach(text => {
console.log(snakeCase(text));
});
const {snakeCase} = require('lodash');
['HelloWorld', 'left pad', 'ECMAScript'].forEach(text => {
console.log(snakeCase(text));
});
// myscript.js
import { snakeCase } from 'https://cdn.skypack.dev/lodash@4';
['HelloWorld', 'left pad', 'ECMAScript'].forEach(text => {
console.log(snakeCase(text));
});
import {snakeCase} from 'lodash';
['HelloWorld', 'left pad', 'ECMAScript'].forEach(text => {
console.log(snakeCase(text));
});
// myscript.ts
import {snakeCase} from 'lodash';
const words: string[] = ['HelloWorld', 'left pad', 'ECMAScript'];
words.forEach(text => {
console.log(snakeCase(text));
});
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script>
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
</script>
// snowpack.config.js
plugins: [
'snowpack-plugin-less',
],
// snowpack.config.js
packageOptions: {
source: 'remote',
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment