es6-module-loader

Unexpected character '@' You may need an appropriate loader to handle this file type

谁说我不能喝 提交于 2019-12-02 10:31:20
问题 This is what I get when I try to run webpack: the error I get is: "ERROR in ./v3/app/styles/main.scss Module parse failed: /Users/vovina/widget-login-react/v3/app/styles/main.scss Unexpected character '@' (1:0) You may need an appropriate loader to handle this file type." it can't resolve @import , any ideas on this? my webpack config is as follow: const childProcess = require('child_process') const CopyWebpackPlugin = require('copy-webpack-plugin') const ExtractTextPlugin = require('extract

Convert old JavaScript code into ES6 module

寵の児 提交于 2019-12-02 07:18:10
I'm trying to convert an old JavaScript library into ES6 compatible module. The library is tracking.js ( https://github.com/eduardolundgren/tracking.js/blob/master/build/tracking.js ) but all my results ends with: Cannot read property 'xxx' of undefined Is there any easy way to use such module? I'm trying to create just basic example like https://trackingjs.com/docs.html#step-2 Update Because there is a request for more code. Let me show one of the non-working examples (part of Vue.js component): import tracking from 'tracking'; export default { created() { const colors = new tracking

Convert old JavaScript code into ES6 module

邮差的信 提交于 2019-12-02 06:45:52
问题 I'm trying to convert an old JavaScript library into ES6 compatible module. The library is tracking.js (https://github.com/eduardolundgren/tracking.js/blob/master/build/tracking.js) but all my results ends with: Cannot read property 'xxx' of undefined Is there any easy way to use such module? I'm trying to create just basic example like https://trackingjs.com/docs.html#step-2 Update Because there is a request for more code. Let me show one of the non-working examples (part of Vue.js component

Trying ES6 imports with Chrome but it doesn't seem to work

旧街凉风 提交于 2019-12-01 15:09:02
I am contemplating moving from Dart to ES6 but Chrome doesn't seem to support the new import statement which is critical to me. I used the (named export) code from this site: http://www.2ality.com/2014/09/es6-modules-final.html I tried it even with <module import="main"><module> I get the error: "Unexpected token import" Any information if they will support it before the final release ? code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>ES6</title> </head> <body bgcolor="blue"> <script type="module" src="main.js"></script> </body> </html> main.js import { square, diag } from

Trying ES6 imports with Chrome but it doesn't seem to work

风格不统一 提交于 2019-12-01 14:00:31
问题 I am contemplating moving from Dart to ES6 but Chrome doesn't seem to support the new import statement which is critical to me. I used the (named export) code from this site: http://www.2ality.com/2014/09/es6-modules-final.html I tried it even with <module import="main"><module> I get the error: "Unexpected token import" Any information if they will support it before the final release ? code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>ES6</title> </head> <body bgcolor="blue

ES6 javascript import external js file

旧巷老猫 提交于 2019-12-01 01:52:21
I'm trying this in my ES6 javascript module: import externalutil from 'https://externalutil.com/js/externalutil.js'; but it fails with this transpile error: Module not found: 'https://externalutil.com/js/externalutil.js' The file externalutil.js is an old-fashioned javascript library that does not export anything. Any help will be appreciated. Joseph Callaars You cannot import URL's (as of yet). You should download the file, put it somewhere locally and reference it locally as well. However in your case, I'd just use a <script /> tag to include it in your html and just access the window object

How can an es6 module import itself?

纵然是瞬间 提交于 2019-12-01 01:04:41
问题 I have a module called fooModule . Inside this module, I import fooModule (itself): import * as fooModule from './fooModule'; export function logFoo() { console.log(fooModule) } When logFoo() is called, I can see all of the exports of the fooModule. How does this work? 回答1: Circular dependencies are no problem for declarative imports/exports. In your case, the circle is of minimal length though :-) The solution is that an import does not import a value into a variable, but that it makes a

Re-exporting ES6 modules in TS 1.7?

北城以北 提交于 2019-11-29 03:47:55
I'm getting a bit lost in TS re-exports. Say I create a pair of test modules; test1.ts; export function test1() { return 'test'; } test2.ts; export function test2() { return 'test'; } I believe I should be able to then do something like this; combined.ts; export * from './test1'; export * from './test2'; module.exports = { test1: test1, test2: test2 }; But, no such luck. There seem to be lots of GitHub issues discussing various approaches to this, including an old hack using export import * from './test1' but they all seem to argue what the ES6 spec really means, and none actually work.. What

How do I extend another VueJS component in a single-file component? (ES6 vue-loader)

久未见 提交于 2019-11-29 02:17:43
问题 I am using vue-loader (http://vuejs.github.io/vue-loader/start/spec.html) to construct my *.vue single-file components, but I am having trouble with the process from extending a single-file component from another. If one component follows the spec to export default { [component "Foo" definition] } , I would think it is just a matter of importing this component (as I would with any child component) and then export default Foo.extend({ [extended component definition] }) Unfortunately this does

Dynamic System.import with webpack?

∥☆過路亽.° 提交于 2019-11-28 10:25:22
I am trying to port some ES6 code I have written that uses systemjs + Babel. I didn't have any problem porting most of the code. However, I have some code that needs to dynamically load an ES6 module, like this: function load(src) { System.import(src).then(function() {}); } src is an external ES6 module which may also have dependencies (static imports). How could I port this code to Webpack ? If I try to use require statement I'm getting a WARNING which seems to be normal according to the Webpack docs. sic1 The previous answers were correct, but now in webpack 2.2 + babel (as of writing, v2.2