Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when create bundle with your source code #1

Open
frankfullstack opened this issue Nov 19, 2016 · 0 comments
Open

Getting error when create bundle with your source code #1

frankfullstack opened this issue Nov 19, 2016 · 0 comments

Comments

@frankfullstack
Copy link

When I run your CLI code I have some errors when I run node bundle.js:

 import { person } from "./person";
        ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

I changed the webpack.config.js file to work fine the webpack cli command:

module.exports = {
  entry: './main.ts',
  output: {
    filename: './bundle.js'
  },
  resolve: {
    extensions: ['', '.ts']
  },
  module: {
    loaders: [
      { test: /.tsx$/, loader: 'awesome-typescript-loader' }
    ]
  }
};

If you didn't put tsx$ it doesn't work.

But the resulting bundle have an Import that is not supported by the browser and Node.JS.

OS. Windows 8.1
CLI. ConEmu Git CLI.
IDE. VSCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant